Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obk
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
This commit is contained in:
commit
7ab50e4006
@ -45,53 +45,6 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
|
||||
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
|
||||
```
|
||||
|
||||
## legacy-constructor-visibility
|
||||
|
||||
[RFC 1506](https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md) modified some
|
||||
visibility rules, and changed the visibility of struct constructors. Some
|
||||
example code that triggers this lint:
|
||||
|
||||
```rust,ignore
|
||||
mod m {
|
||||
pub struct S(u8);
|
||||
|
||||
fn f() {
|
||||
// this is trying to use S from the 'use' line, but because the `u8` is
|
||||
// not pub, it is private
|
||||
::S;
|
||||
}
|
||||
}
|
||||
|
||||
use m::S;
|
||||
```
|
||||
|
||||
This will produce:
|
||||
|
||||
```text
|
||||
error: private struct constructors are not usable through re-exports in outer modules
|
||||
--> src/main.rs:5:9
|
||||
|
|
||||
5 | ::S;
|
||||
| ^^^
|
||||
|
|
||||
= note: `#[deny(legacy_constructor_visibility)]` 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!
|
||||
= note: for more information, see issue #39207 <https://github.com/rust-lang/rust/issues/39207>
|
||||
```
|
||||
|
||||
|
||||
## legacy-directory-ownership
|
||||
|
||||
The legacy_directory_ownership warning is issued when
|
||||
|
||||
* There is a non-inline module with a `#[path]` attribute (e.g. `#[path = "foo.rs"] mod bar;`),
|
||||
* The module's file ("foo.rs" in the above example) is not named "mod.rs", and
|
||||
* The module's file contains a non-inline child module without a `#[path]` attribute.
|
||||
|
||||
The warning can be fixed by renaming the parent module to "mod.rs" and moving
|
||||
it into its own directory if appropriate.
|
||||
|
||||
|
||||
## missing-fragment-specifier
|
||||
|
||||
The missing_fragment_specifier warning is issued when an unused pattern in a
|
||||
@ -169,40 +122,50 @@ error: literal out of range for u8
|
||||
|
|
||||
```
|
||||
|
||||
## parenthesized-params-in-types-and-modules
|
||||
## patterns-in-fns-without-body
|
||||
|
||||
This lint detects incorrect parentheses. Some example code that triggers this
|
||||
lint:
|
||||
This lint detects patterns in functions without body were that were
|
||||
previously erroneously allowed. Some example code that triggers this lint:
|
||||
|
||||
```rust,ignore
|
||||
let x = 5 as usize();
|
||||
```rust,compile_fail
|
||||
trait Trait {
|
||||
fn foo(mut arg: u8);
|
||||
}
|
||||
```
|
||||
|
||||
This will produce:
|
||||
|
||||
```text
|
||||
error: parenthesized parameters may only be used with a trait
|
||||
--> src/main.rs:2:21
|
||||
warning: patterns aren't allowed in methods without bodies
|
||||
--> src/main.rs:2:12
|
||||
|
|
||||
2 | let x = 5 as usize();
|
||||
| ^^
|
||||
2 | fn foo(mut arg: u8);
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default
|
||||
= note: `#[warn(patterns_in_fns_without_body)]` 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!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
= note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
|
||||
```
|
||||
|
||||
To fix it, remove the `()`s.
|
||||
To fix this, remove the pattern; it can be used in the implementation without
|
||||
being used in the definition. That is:
|
||||
|
||||
```rust
|
||||
trait Trait {
|
||||
fn foo(arg: u8);
|
||||
}
|
||||
|
||||
impl Trait for i32 {
|
||||
fn foo(mut arg: u8) {
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## pub-use-of-private-extern-crate
|
||||
|
||||
This lint detects a specific situation of re-exporting a private `extern crate`;
|
||||
|
||||
## safe-extern-statics
|
||||
|
||||
In older versions of Rust, there was a soundness issue where `extern static`s were allowed
|
||||
to be accessed in safe code. This lint now catches and denies this kind of code.
|
||||
|
||||
## unknown-crate-types
|
||||
|
||||
This lint detects an unknown crate type found in a `#[crate_type]` directive. Some
|
||||
|
@ -307,46 +307,6 @@ warning: path statement with no effect
|
||||
|
|
||||
```
|
||||
|
||||
## patterns-in-fns-without-body
|
||||
|
||||
This lint detects patterns in functions without body were that were
|
||||
previously erroneously allowed. Some example code that triggers this lint:
|
||||
|
||||
```rust
|
||||
trait Trait {
|
||||
fn foo(mut arg: u8);
|
||||
}
|
||||
```
|
||||
|
||||
This will produce:
|
||||
|
||||
```text
|
||||
warning: patterns aren't allowed in methods without bodies
|
||||
--> src/main.rs:2:12
|
||||
|
|
||||
2 | fn foo(mut arg: u8);
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `#[warn(patterns_in_fns_without_body)]` 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!
|
||||
= note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
|
||||
```
|
||||
|
||||
To fix this, remove the pattern; it can be used in the implementation without
|
||||
being used in the definition. That is:
|
||||
|
||||
```rust
|
||||
trait Trait {
|
||||
fn foo(arg: u8);
|
||||
}
|
||||
|
||||
impl Trait for i32 {
|
||||
fn foo(mut arg: u8) {
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## plugin-as-library
|
||||
|
||||
This lint detects when compiler plugins are used as ordinary library in
|
||||
|
@ -44,8 +44,7 @@ use crate::hir::def::{Namespace, Res, DefKind, PartialRes, PerNS};
|
||||
use crate::hir::{GenericArg, ConstArg};
|
||||
use crate::hir::ptr::P;
|
||||
use crate::lint;
|
||||
use crate::lint::builtin::{self, PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
|
||||
ELIDED_LIFETIMES_IN_PATHS};
|
||||
use crate::lint::builtin::{self, ELIDED_LIFETIMES_IN_PATHS};
|
||||
use crate::middle::cstore::CrateStore;
|
||||
use crate::session::Session;
|
||||
use crate::session::config::nightly_options;
|
||||
@ -298,7 +297,6 @@ enum ParamMode {
|
||||
|
||||
enum ParenthesizedGenericArgs {
|
||||
Ok,
|
||||
Warn,
|
||||
Err,
|
||||
}
|
||||
|
||||
@ -1701,29 +1699,19 @@ impl<'a> LoweringContext<'a> {
|
||||
};
|
||||
let parenthesized_generic_args = match partial_res.base_res() {
|
||||
// `a::b::Trait(Args)`
|
||||
Res::Def(DefKind::Trait, _)
|
||||
if i + 1 == proj_start => ParenthesizedGenericArgs::Ok,
|
||||
Res::Def(DefKind::Trait, _) if i + 1 == proj_start => {
|
||||
ParenthesizedGenericArgs::Ok
|
||||
}
|
||||
// `a::b::Trait(Args)::TraitItem`
|
||||
Res::Def(DefKind::Method, _)
|
||||
| Res::Def(DefKind::AssocConst, _)
|
||||
| Res::Def(DefKind::AssocTy, _)
|
||||
if i + 2 == proj_start =>
|
||||
{
|
||||
Res::Def(DefKind::Method, _) |
|
||||
Res::Def(DefKind::AssocConst, _) |
|
||||
Res::Def(DefKind::AssocTy, _) if i + 2 == proj_start => {
|
||||
ParenthesizedGenericArgs::Ok
|
||||
}
|
||||
// Avoid duplicated errors.
|
||||
Res::Err => ParenthesizedGenericArgs::Ok,
|
||||
// An error
|
||||
Res::Def(DefKind::Struct, _)
|
||||
| Res::Def(DefKind::Enum, _)
|
||||
| Res::Def(DefKind::Union, _)
|
||||
| Res::Def(DefKind::TyAlias, _)
|
||||
| Res::Def(DefKind::Variant, _) if i + 1 == proj_start =>
|
||||
{
|
||||
ParenthesizedGenericArgs::Err
|
||||
}
|
||||
// A warning for now, for compatibility reasons.
|
||||
_ => ParenthesizedGenericArgs::Warn,
|
||||
_ => ParenthesizedGenericArgs::Err,
|
||||
};
|
||||
|
||||
let num_lifetimes = type_def_id.map_or(0, |def_id| {
|
||||
@ -1786,7 +1774,7 @@ impl<'a> LoweringContext<'a> {
|
||||
segment,
|
||||
param_mode,
|
||||
0,
|
||||
ParenthesizedGenericArgs::Warn,
|
||||
ParenthesizedGenericArgs::Err,
|
||||
itctx.reborrow(),
|
||||
None,
|
||||
));
|
||||
@ -1862,15 +1850,6 @@ impl<'a> LoweringContext<'a> {
|
||||
}
|
||||
GenericArgs::Parenthesized(ref data) => match parenthesized_generic_args {
|
||||
ParenthesizedGenericArgs::Ok => self.lower_parenthesized_parameter_data(data),
|
||||
ParenthesizedGenericArgs::Warn => {
|
||||
self.resolver.lint_buffer().buffer_lint(
|
||||
PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
|
||||
CRATE_NODE_ID,
|
||||
data.span,
|
||||
msg.into(),
|
||||
);
|
||||
(hir::GenericArgs::none(), true)
|
||||
}
|
||||
ParenthesizedGenericArgs::Err => {
|
||||
let mut err = struct_span_err!(self.sess, data.span, E0214, "{}", msg);
|
||||
err.span_label(data.span, "only `Fn` traits may use parentheses");
|
||||
|
@ -177,16 +177,6 @@ declare_lint! {
|
||||
"lints that have been renamed or removed"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub SAFE_EXTERN_STATICS,
|
||||
Deny,
|
||||
"safe access to extern statics was erroneously allowed",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #36247 <https://github.com/rust-lang/rust/issues/36247>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub SAFE_PACKED_BORROWS,
|
||||
Warn,
|
||||
@ -199,7 +189,7 @@ declare_lint! {
|
||||
|
||||
declare_lint! {
|
||||
pub PATTERNS_IN_FNS_WITHOUT_BODY,
|
||||
Warn,
|
||||
Deny,
|
||||
"patterns in functions without body were erroneously allowed",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
||||
@ -207,27 +197,6 @@ declare_lint! {
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub LEGACY_DIRECTORY_OWNERSHIP,
|
||||
Deny,
|
||||
"non-inline, non-`#[path]` modules (e.g., `mod foo;`) were erroneously allowed in some files \
|
||||
not named `mod.rs`",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #37872 <https://github.com/rust-lang/rust/issues/37872>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub LEGACY_CONSTRUCTOR_VISIBILITY,
|
||||
Deny,
|
||||
"detects use of struct constructors that would be invisible with new visibility rules",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #39207 <https://github.com/rust-lang/rust/issues/39207>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub MISSING_FRAGMENT_SPECIFIER,
|
||||
Deny,
|
||||
@ -238,16 +207,6 @@ declare_lint! {
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
|
||||
Deny,
|
||||
"detects parenthesized generic parameters in type and module names",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #42238 <https://github.com/rust-lang/rust/issues/42238>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub LATE_BOUND_LIFETIME_ARGUMENTS,
|
||||
Warn,
|
||||
@ -372,16 +331,6 @@ declare_lint! {
|
||||
"detects labels that are never used"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub DUPLICATE_MACRO_EXPORTS,
|
||||
Deny,
|
||||
"detects duplicate macro exports",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #35896 <https://github.com/rust-lang/rust/issues/35896>",
|
||||
edition: Some(Edition::Edition2018),
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub INTRA_DOC_LINK_RESOLUTION_FAILURE,
|
||||
Warn,
|
||||
@ -459,7 +408,7 @@ declare_lint! {
|
||||
pub mod parser {
|
||||
declare_lint! {
|
||||
pub ILL_FORMED_ATTRIBUTE_INPUT,
|
||||
Warn,
|
||||
Deny,
|
||||
"ill-formed attribute inputs that were previously accepted and used in practice",
|
||||
@future_incompatible = super::FutureIncompatibleInfo {
|
||||
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
||||
@ -497,16 +446,6 @@ declare_lint! {
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub NESTED_IMPL_TRAIT,
|
||||
Warn,
|
||||
"nested occurrence of `impl Trait` type",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #59014 <https://github.com/rust-lang/rust/issues/59014>",
|
||||
edition: None,
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub MUTABLE_BORROW_RESERVATION_CONFLICT,
|
||||
Warn,
|
||||
@ -556,13 +495,9 @@ declare_lint_pass! {
|
||||
INVALID_TYPE_PARAM_DEFAULT,
|
||||
CONST_ERR,
|
||||
RENAMED_AND_REMOVED_LINTS,
|
||||
SAFE_EXTERN_STATICS,
|
||||
SAFE_PACKED_BORROWS,
|
||||
PATTERNS_IN_FNS_WITHOUT_BODY,
|
||||
LEGACY_DIRECTORY_OWNERSHIP,
|
||||
LEGACY_CONSTRUCTOR_VISIBILITY,
|
||||
MISSING_FRAGMENT_SPECIFIER,
|
||||
PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
|
||||
LATE_BOUND_LIFETIME_ARGUMENTS,
|
||||
ORDER_DEPENDENT_TRAIT_OBJECTS,
|
||||
DEPRECATED,
|
||||
@ -578,7 +513,6 @@ declare_lint_pass! {
|
||||
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
|
||||
UNSTABLE_NAME_COLLISIONS,
|
||||
IRREFUTABLE_LET_PATTERNS,
|
||||
DUPLICATE_MACRO_EXPORTS,
|
||||
INTRA_DOC_LINK_RESOLUTION_FAILURE,
|
||||
MISSING_DOC_CODE_EXAMPLES,
|
||||
PRIVATE_DOC_TESTS,
|
||||
@ -590,7 +524,6 @@ declare_lint_pass! {
|
||||
parser::META_VARIABLE_MISUSE,
|
||||
DEPRECATED_IN_FUTURE,
|
||||
AMBIGUOUS_ASSOCIATED_ITEMS,
|
||||
NESTED_IMPL_TRAIT,
|
||||
MUTABLE_BORROW_RESERVATION_CONFLICT,
|
||||
INDIRECT_STRUCTURAL_MATCH,
|
||||
SOFT_UNSTABLE,
|
||||
@ -604,13 +537,11 @@ pub enum BuiltinLintDiagnostics {
|
||||
Normal,
|
||||
BareTraitObject(Span, /* is_global */ bool),
|
||||
AbsPathWithModule(Span),
|
||||
DuplicatedMacroExports(ast::Ident, Span, Span),
|
||||
ProcMacroDeriveResolutionFallback(Span),
|
||||
MacroExpandedMacroExportsAccessedByAbsolutePaths(Span),
|
||||
ElidedLifetimesInPaths(usize, Span, bool, Span, String),
|
||||
UnknownCrateTypes(Span, String, String),
|
||||
UnusedImports(String, Vec<(Span, String)>),
|
||||
NestedImplTrait { outer_impl_trait_span: Span, inner_impl_trait_span: Span },
|
||||
RedundantImport(Vec<(Span, bool)>, ast::Ident),
|
||||
DeprecatedMacro(Option<Symbol>, Span),
|
||||
}
|
||||
@ -687,10 +618,6 @@ impl BuiltinLintDiagnostics {
|
||||
};
|
||||
db.span_suggestion(span, "use `crate`", sugg, app);
|
||||
}
|
||||
BuiltinLintDiagnostics::DuplicatedMacroExports(ident, earlier_span, later_span) => {
|
||||
db.span_label(later_span, format!("`{}` already exported", ident));
|
||||
db.span_note(earlier_span, "previous macro export is now shadowed");
|
||||
}
|
||||
BuiltinLintDiagnostics::ProcMacroDeriveResolutionFallback(span) => {
|
||||
db.span_label(span, "names from parent modules are not \
|
||||
accessible without an explicit import");
|
||||
@ -723,12 +650,6 @@ impl BuiltinLintDiagnostics {
|
||||
);
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::NestedImplTrait {
|
||||
outer_impl_trait_span, inner_impl_trait_span
|
||||
} => {
|
||||
db.span_label(outer_impl_trait_span, "outer `impl Trait`");
|
||||
db.span_label(inner_impl_trait_span, "nested `impl Trait` here");
|
||||
}
|
||||
BuiltinLintDiagnostics::RedundantImport(spans, ident) => {
|
||||
for (span, is_imported) in spans {
|
||||
let introduced = if is_imported { "imported" } else { "defined" };
|
||||
|
@ -2701,7 +2701,6 @@ pub enum UnsafetyViolationKind {
|
||||
General,
|
||||
/// Permitted both in `const fn`s and regular `fn`s.
|
||||
GeneralAndConstFn,
|
||||
ExternStatic(hir::HirId),
|
||||
BorrowPacked(hir::HirId),
|
||||
}
|
||||
|
||||
|
@ -339,6 +339,18 @@ fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool) {
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/57742");
|
||||
store.register_removed("incoherent_fundamental_impls",
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/46205");
|
||||
store.register_removed("legacy_constructor_visibility",
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/39207");
|
||||
store.register_removed("legacy_disrectory_ownership",
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/37872");
|
||||
store.register_removed("safe_extern_statics",
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/36247");
|
||||
store.register_removed("parenthesized_params_in_types_and_modules",
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/42238");
|
||||
store.register_removed("duplicate_macro_exports",
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/35896");
|
||||
store.register_removed("nested_impl_trait",
|
||||
"converted into hard error, see https://github.com/rust-lang/rust/issues/59014");
|
||||
}
|
||||
|
||||
fn register_internals(store: &mut lint::LintStore) {
|
||||
|
@ -8,7 +8,7 @@ use rustc::ty::cast::CastTy;
|
||||
use rustc::hir;
|
||||
use rustc::hir::Node;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::lint::builtin::{SAFE_EXTERN_STATICS, SAFE_PACKED_BORROWS, UNUSED_UNSAFE};
|
||||
use rustc::lint::builtin::{SAFE_PACKED_BORROWS, UNUSED_UNSAFE};
|
||||
use rustc::mir::*;
|
||||
use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext};
|
||||
|
||||
@ -208,23 +208,20 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
|
||||
}
|
||||
PlaceBase::Static(box Static { kind: StaticKind::Static, def_id, .. }) => {
|
||||
if self.tcx.is_mutable_static(def_id) {
|
||||
self.require_unsafe("use of mutable static",
|
||||
self.require_unsafe(
|
||||
"use of mutable static",
|
||||
"mutable statics can be mutated by multiple threads: aliasing \
|
||||
violations or data races will cause undefined behavior",
|
||||
UnsafetyViolationKind::General);
|
||||
violations or data races will cause undefined behavior",
|
||||
UnsafetyViolationKind::General,
|
||||
);
|
||||
} else if self.tcx.is_foreign_item(def_id) {
|
||||
let source_info = self.source_info;
|
||||
let lint_root =
|
||||
self.source_scope_local_data[source_info.scope].lint_root;
|
||||
self.register_violations(&[UnsafetyViolation {
|
||||
source_info,
|
||||
description: Symbol::intern("use of extern static"),
|
||||
details: Symbol::intern(
|
||||
"extern statics are not controlled by the Rust type system: \
|
||||
invalid data, aliasing violations or data races will cause \
|
||||
undefined behavior"),
|
||||
kind: UnsafetyViolationKind::ExternStatic(lint_root)
|
||||
}], &[]);
|
||||
self.require_unsafe(
|
||||
"use of extern static",
|
||||
"extern statics are not controlled by the Rust type system: \
|
||||
invalid data, aliasing violations or data races will cause \
|
||||
undefined behavior",
|
||||
UnsafetyViolationKind::General,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -351,8 +348,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
|
||||
match violation.kind {
|
||||
UnsafetyViolationKind::GeneralAndConstFn |
|
||||
UnsafetyViolationKind::General => {},
|
||||
UnsafetyViolationKind::BorrowPacked(_) |
|
||||
UnsafetyViolationKind::ExternStatic(_) => if self.min_const_fn {
|
||||
UnsafetyViolationKind::BorrowPacked(_) => if self.min_const_fn {
|
||||
// const fns don't need to be backwards compatible and can
|
||||
// emit these violations as a hard error instead of a backwards
|
||||
// compat lint
|
||||
@ -380,8 +376,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
|
||||
UnsafetyViolationKind::GeneralAndConstFn => {},
|
||||
// these things are forbidden in const fns
|
||||
UnsafetyViolationKind::General |
|
||||
UnsafetyViolationKind::BorrowPacked(_) |
|
||||
UnsafetyViolationKind::ExternStatic(_) => {
|
||||
UnsafetyViolationKind::BorrowPacked(_) => {
|
||||
let mut violation = violation.clone();
|
||||
// const fns don't need to be backwards compatible and can
|
||||
// emit these violations as a hard error instead of a backwards
|
||||
@ -646,14 +641,6 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: DefId) {
|
||||
.note(&details.as_str())
|
||||
.emit();
|
||||
}
|
||||
UnsafetyViolationKind::ExternStatic(lint_hir_id) => {
|
||||
tcx.lint_node_note(SAFE_EXTERN_STATICS,
|
||||
lint_hir_id,
|
||||
source_info.span,
|
||||
&format!("{} is unsafe and requires unsafe function or block \
|
||||
(error E0133)", description),
|
||||
&details.as_str());
|
||||
}
|
||||
UnsafetyViolationKind::BorrowPacked(lint_hir_id) => {
|
||||
if let Some(impl_def_id) = builtin_derive_def_id(tcx, def_id) {
|
||||
tcx.unsafe_derive_on_repr_packed(impl_def_id);
|
||||
|
@ -9,7 +9,6 @@
|
||||
use std::mem;
|
||||
use syntax::print::pprust;
|
||||
use rustc::lint;
|
||||
use rustc::lint::builtin::{BuiltinLintDiagnostics, NESTED_IMPL_TRAIT};
|
||||
use rustc::session::Session;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use syntax::ast::*;
|
||||
@ -23,31 +22,6 @@ use syntax::{span_err, struct_span_err, walk_list};
|
||||
use syntax_pos::{Span, MultiSpan};
|
||||
use errors::{Applicability, FatalError};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
struct OuterImplTrait {
|
||||
span: Span,
|
||||
|
||||
/// rust-lang/rust#57979: a bug in original implementation caused
|
||||
/// us to fail sometimes to record an outer `impl Trait`.
|
||||
/// Therefore, in order to reliably issue a warning (rather than
|
||||
/// an error) in the *precise* places where we are newly injecting
|
||||
/// the diagnostic, we have to distinguish between the places
|
||||
/// where the outer `impl Trait` has always been recorded, versus
|
||||
/// the places where it has only recently started being recorded.
|
||||
only_recorded_since_pull_request_57730: bool,
|
||||
}
|
||||
|
||||
impl OuterImplTrait {
|
||||
/// This controls whether we should downgrade the nested impl
|
||||
/// trait diagnostic to a warning rather than an error, based on
|
||||
/// whether the outer impl trait had been improperly skipped in
|
||||
/// earlier implementations of the analysis on the stable
|
||||
/// compiler.
|
||||
fn should_warn_instead_of_error(&self) -> bool {
|
||||
self.only_recorded_since_pull_request_57730
|
||||
}
|
||||
}
|
||||
|
||||
struct AstValidator<'a> {
|
||||
session: &'a Session,
|
||||
has_proc_macro_decls: bool,
|
||||
@ -55,7 +29,7 @@ struct AstValidator<'a> {
|
||||
/// Used to ban nested `impl Trait`, e.g., `impl Into<impl Debug>`.
|
||||
/// Nested `impl Trait` _is_ allowed in associated type position,
|
||||
/// e.g., `impl Iterator<Item = impl Debug>`.
|
||||
outer_impl_trait: Option<OuterImplTrait>,
|
||||
outer_impl_trait: Option<Span>,
|
||||
|
||||
/// Used to ban `impl Trait` in path projections like `<impl Iterator>::Item`
|
||||
/// or `Foo::Bar<impl Trait>`
|
||||
@ -65,26 +39,10 @@ struct AstValidator<'a> {
|
||||
/// certain positions.
|
||||
is_assoc_ty_bound_banned: bool,
|
||||
|
||||
/// rust-lang/rust#57979: the ban of nested `impl Trait` was buggy
|
||||
/// until PRs #57730 and #57981 landed: it would jump directly to
|
||||
/// walk_ty rather than visit_ty (or skip recurring entirely for
|
||||
/// impl trait in projections), and thus miss some cases. We track
|
||||
/// whether we should downgrade to a warning for short-term via
|
||||
/// these booleans.
|
||||
warning_period_57979_didnt_record_next_impl_trait: bool,
|
||||
warning_period_57979_impl_trait_in_proj: bool,
|
||||
|
||||
lint_buffer: &'a mut lint::LintBuffer,
|
||||
}
|
||||
|
||||
impl<'a> AstValidator<'a> {
|
||||
fn with_impl_trait_in_proj_warning<T>(&mut self, v: bool, f: impl FnOnce(&mut Self) -> T) -> T {
|
||||
let old = mem::replace(&mut self.warning_period_57979_impl_trait_in_proj, v);
|
||||
let ret = f(self);
|
||||
self.warning_period_57979_impl_trait_in_proj = old;
|
||||
ret
|
||||
}
|
||||
|
||||
fn with_banned_impl_trait(&mut self, f: impl FnOnce(&mut Self)) {
|
||||
let old = mem::replace(&mut self.is_impl_trait_banned, true);
|
||||
f(self);
|
||||
@ -97,7 +55,7 @@ impl<'a> AstValidator<'a> {
|
||||
self.is_assoc_ty_bound_banned = old;
|
||||
}
|
||||
|
||||
fn with_impl_trait(&mut self, outer: Option<OuterImplTrait>, f: impl FnOnce(&mut Self)) {
|
||||
fn with_impl_trait(&mut self, outer: Option<Span>, f: impl FnOnce(&mut Self)) {
|
||||
let old = mem::replace(&mut self.outer_impl_trait, outer);
|
||||
f(self);
|
||||
self.outer_impl_trait = old;
|
||||
@ -105,14 +63,7 @@ impl<'a> AstValidator<'a> {
|
||||
|
||||
fn visit_assoc_ty_constraint_from_generic_args(&mut self, constraint: &'a AssocTyConstraint) {
|
||||
match constraint.kind {
|
||||
AssocTyConstraintKind::Equality { ref ty } => {
|
||||
// rust-lang/rust#57979: bug in old `visit_generic_args` called
|
||||
// `walk_ty` rather than `visit_ty`, skipping outer `impl Trait`
|
||||
// if it happened to occur at `ty`.
|
||||
if let TyKind::ImplTrait(..) = ty.kind {
|
||||
self.warning_period_57979_didnt_record_next_impl_trait = true;
|
||||
}
|
||||
}
|
||||
AssocTyConstraintKind::Equality { .. } => {}
|
||||
AssocTyConstraintKind::Bound { .. } => {
|
||||
if self.is_assoc_ty_bound_banned {
|
||||
self.err_handler().span_err(constraint.span,
|
||||
@ -124,37 +75,11 @@ impl<'a> AstValidator<'a> {
|
||||
self.visit_assoc_ty_constraint(constraint);
|
||||
}
|
||||
|
||||
fn visit_ty_from_generic_args(&mut self, ty: &'a Ty) {
|
||||
// rust-lang/rust#57979: bug in old `visit_generic_args` called
|
||||
// `walk_ty` rather than `visit_ty`, skippping outer `impl Trait`
|
||||
// if it happened to occur at `ty`.
|
||||
if let TyKind::ImplTrait(..) = ty.kind {
|
||||
self.warning_period_57979_didnt_record_next_impl_trait = true;
|
||||
}
|
||||
self.visit_ty(ty);
|
||||
}
|
||||
|
||||
fn outer_impl_trait(&mut self, span: Span) -> OuterImplTrait {
|
||||
let only_recorded_since_pull_request_57730 =
|
||||
self.warning_period_57979_didnt_record_next_impl_trait;
|
||||
|
||||
// (This flag is designed to be set to `true`, and then only
|
||||
// reach the construction point for the outer impl trait once,
|
||||
// so its safe and easiest to unconditionally reset it to
|
||||
// false.)
|
||||
self.warning_period_57979_didnt_record_next_impl_trait = false;
|
||||
|
||||
OuterImplTrait {
|
||||
span, only_recorded_since_pull_request_57730,
|
||||
}
|
||||
}
|
||||
|
||||
// Mirrors `visit::walk_ty`, but tracks relevant state.
|
||||
fn walk_ty(&mut self, t: &'a Ty) {
|
||||
match t.kind {
|
||||
TyKind::ImplTrait(..) => {
|
||||
let outer_impl_trait = self.outer_impl_trait(t.span);
|
||||
self.with_impl_trait(Some(outer_impl_trait), |this| visit::walk_ty(this, t))
|
||||
self.with_impl_trait(Some(t.span), |this| visit::walk_ty(this, t))
|
||||
}
|
||||
TyKind::Path(ref qself, ref path) => {
|
||||
// We allow these:
|
||||
@ -484,32 +409,21 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
}
|
||||
TyKind::ImplTrait(_, ref bounds) => {
|
||||
if self.is_impl_trait_banned {
|
||||
if self.warning_period_57979_impl_trait_in_proj {
|
||||
self.lint_buffer.buffer_lint(
|
||||
NESTED_IMPL_TRAIT, ty.id, ty.span,
|
||||
"`impl Trait` is not allowed in path parameters");
|
||||
} else {
|
||||
struct_span_err!(self.session, ty.span, E0667,
|
||||
"`impl Trait` is not allowed in path parameters").emit();
|
||||
}
|
||||
struct_span_err!(
|
||||
self.session, ty.span, E0667,
|
||||
"`impl Trait` is not allowed in path parameters"
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
if let Some(outer_impl_trait) = self.outer_impl_trait {
|
||||
if outer_impl_trait.should_warn_instead_of_error() {
|
||||
self.lint_buffer.buffer_lint_with_diagnostic(
|
||||
NESTED_IMPL_TRAIT, ty.id, ty.span,
|
||||
"nested `impl Trait` is not allowed",
|
||||
BuiltinLintDiagnostics::NestedImplTrait {
|
||||
outer_impl_trait_span: outer_impl_trait.span,
|
||||
inner_impl_trait_span: ty.span,
|
||||
});
|
||||
} else {
|
||||
struct_span_err!(self.session, ty.span, E0666,
|
||||
"nested `impl Trait` is not allowed")
|
||||
.span_label(outer_impl_trait.span, "outer `impl Trait`")
|
||||
.span_label(ty.span, "nested `impl Trait` here")
|
||||
.emit();
|
||||
}
|
||||
if let Some(outer_impl_trait_sp) = self.outer_impl_trait {
|
||||
struct_span_err!(
|
||||
self.session, ty.span, E0666,
|
||||
"nested `impl Trait` is not allowed"
|
||||
)
|
||||
.span_label(outer_impl_trait_sp, "outer `impl Trait`")
|
||||
.span_label(ty.span, "nested `impl Trait` here")
|
||||
.emit();
|
||||
}
|
||||
|
||||
if !bounds.iter()
|
||||
@ -517,7 +431,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
self.err_handler().span_err(ty.span, "at least one trait must be specified");
|
||||
}
|
||||
|
||||
self.with_impl_trait_in_proj_warning(true, |this| this.walk_ty(ty));
|
||||
self.walk_ty(ty);
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
@ -654,11 +568,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
ItemKind::Mod(_) => {
|
||||
// Ensure that `path` attributes on modules are recorded as used (cf. issue #35584).
|
||||
attr::first_attr_value_str_by_name(&item.attrs, sym::path);
|
||||
if attr::contains_name(&item.attrs, sym::warn_directory_ownership) {
|
||||
let lint = lint::builtin::LEGACY_DIRECTORY_OWNERSHIP;
|
||||
let msg = "cannot declare a new module at this location";
|
||||
self.lint_buffer.buffer_lint(lint, item.id, item.span, msg);
|
||||
}
|
||||
}
|
||||
ItemKind::Union(ref vdata, _) => {
|
||||
if let VariantData::Tuple(..) | VariantData::Unit(..) = vdata {
|
||||
@ -731,7 +640,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
if let Some(ref type_) = data.output {
|
||||
// `-> Foo` syntax is essentially an associated type binding,
|
||||
// so it is also allowed to contain nested `impl Trait`.
|
||||
self.with_impl_trait(None, |this| this.visit_ty_from_generic_args(type_));
|
||||
self.with_impl_trait(None, |this| this.visit_ty(type_));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -849,8 +758,6 @@ pub fn check_crate(session: &Session, krate: &Crate, lints: &mut lint::LintBuffe
|
||||
outer_impl_trait: None,
|
||||
is_impl_trait_banned: false,
|
||||
is_assoc_ty_bound_banned: false,
|
||||
warning_period_57979_didnt_record_next_impl_trait: false,
|
||||
warning_period_57979_impl_trait_in_proj: false,
|
||||
lint_buffer: lints,
|
||||
};
|
||||
visit::walk_crate(&mut validator, krate);
|
||||
|
@ -1539,25 +1539,7 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
|
||||
if is_expected(partial_res.base_res()) || partial_res.base_res() == Res::Err {
|
||||
partial_res
|
||||
} else {
|
||||
// Add a temporary hack to smooth the transition to new struct ctor
|
||||
// visibility rules. See #38932 for more details.
|
||||
let mut res = None;
|
||||
if let Res::Def(DefKind::Struct, def_id) = partial_res.base_res() {
|
||||
if let Some((ctor_res, ctor_vis))
|
||||
= self.r.struct_constructors.get(&def_id).cloned() {
|
||||
if is_expected(ctor_res) &&
|
||||
self.r.is_accessible_from(ctor_vis, self.parent_scope.module) {
|
||||
let lint = lint::builtin::LEGACY_CONSTRUCTOR_VISIBILITY;
|
||||
self.r.lint_buffer.buffer_lint(lint, id, span,
|
||||
"private struct constructors are not usable through \
|
||||
re-exports in outer modules",
|
||||
);
|
||||
res = Some(PartialRes::new(ctor_res));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res.unwrap_or_else(|| report_errors(self, Some(partial_res.base_res())))
|
||||
report_errors(self, Some(partial_res.base_res()))
|
||||
}
|
||||
}
|
||||
Some(partial_res) if source.defer_to_typeck() => {
|
||||
|
@ -16,18 +16,14 @@ use errors::{Applicability, pluralize};
|
||||
use rustc_data_structures::ptr_key::PtrKey;
|
||||
use rustc::ty;
|
||||
use rustc::lint::builtin::BuiltinLintDiagnostics;
|
||||
use rustc::lint::builtin::{
|
||||
DUPLICATE_MACRO_EXPORTS,
|
||||
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
||||
UNUSED_IMPORTS,
|
||||
};
|
||||
use rustc::lint::builtin::{PUB_USE_OF_PRIVATE_EXTERN_CRATE, UNUSED_IMPORTS};
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::def::{self, PartialRes, Export};
|
||||
use rustc::session::DiagnosticMessageId;
|
||||
use rustc::util::nodemap::FxHashSet;
|
||||
use rustc::{bug, span_bug};
|
||||
|
||||
use syntax::ast::{Ident, Name, NodeId, CRATE_NODE_ID};
|
||||
use syntax::ast::{Ident, Name, NodeId};
|
||||
use syntax::symbol::kw;
|
||||
use syntax::util::lev_distance::find_best_match_for_name;
|
||||
use syntax::{struct_span_err, unwrap_or};
|
||||
@ -496,13 +492,13 @@ impl<'a> Resolver<'a> {
|
||||
if let (&NameBindingKind::Res(_, true), &NameBindingKind::Res(_, true)) =
|
||||
(&old_binding.kind, &binding.kind) {
|
||||
|
||||
this.lint_buffer.buffer_lint_with_diagnostic(
|
||||
DUPLICATE_MACRO_EXPORTS,
|
||||
CRATE_NODE_ID,
|
||||
this.session.struct_span_err(
|
||||
binding.span,
|
||||
&format!("a macro named `{}` has already been exported", key.ident),
|
||||
BuiltinLintDiagnostics::DuplicatedMacroExports(
|
||||
key.ident, old_binding.span, binding.span));
|
||||
)
|
||||
.span_label(binding.span, format!("`{}` already exported", key.ident))
|
||||
.span_note(old_binding.span, "previous macro export is now shadowed")
|
||||
.emit();
|
||||
|
||||
resolution.binding = Some(binding);
|
||||
} else {
|
||||
|
@ -37,7 +37,7 @@ pub enum DirectoryOwnership {
|
||||
relative: Option<ast::Ident>,
|
||||
},
|
||||
UnownedViaBlock,
|
||||
UnownedViaMod(bool /* legacy warnings? */),
|
||||
UnownedViaMod,
|
||||
}
|
||||
|
||||
// A bunch of utility functions of the form `parse_<thing>_from_<source>`
|
||||
|
@ -23,7 +23,6 @@ pub(super) struct ModulePath {
|
||||
pub(super) struct ModulePathSuccess {
|
||||
pub path: PathBuf,
|
||||
pub directory_ownership: DirectoryOwnership,
|
||||
warn: bool,
|
||||
}
|
||||
|
||||
impl<'a> Parser<'a> {
|
||||
@ -57,17 +56,10 @@ impl<'a> Parser<'a> {
|
||||
if self.eat(&token::Semi) {
|
||||
if in_cfg && self.recurse_into_file_modules {
|
||||
// This mod is in an external file. Let's go get it!
|
||||
let ModulePathSuccess { path, directory_ownership, warn } =
|
||||
let ModulePathSuccess { path, directory_ownership } =
|
||||
self.submod_path(id, &outer_attrs, id_span)?;
|
||||
let (module, mut attrs) =
|
||||
let (module, attrs) =
|
||||
self.eval_src_mod(path, directory_ownership, id.to_string(), id_span)?;
|
||||
// Record that we fetched the mod from an external file.
|
||||
if warn {
|
||||
let attr = attr::mk_attr_outer(
|
||||
attr::mk_word_item(Ident::with_dummy_span(sym::warn_directory_ownership)));
|
||||
attr::mark_known(&attr);
|
||||
attrs.push(attr);
|
||||
}
|
||||
Ok((id, ItemKind::Mod(module), Some(attrs)))
|
||||
} else {
|
||||
let placeholder = ast::Mod {
|
||||
@ -138,17 +130,16 @@ impl<'a> Parser<'a> {
|
||||
// `#[path]` included and contains a `mod foo;` declaration.
|
||||
// If you encounter this, it's your own darn fault :P
|
||||
Some(_) => DirectoryOwnership::Owned { relative: None },
|
||||
_ => DirectoryOwnership::UnownedViaMod(true),
|
||||
_ => DirectoryOwnership::UnownedViaMod,
|
||||
},
|
||||
path,
|
||||
warn: false,
|
||||
});
|
||||
}
|
||||
|
||||
let relative = match self.directory.ownership {
|
||||
DirectoryOwnership::Owned { relative } => relative,
|
||||
DirectoryOwnership::UnownedViaBlock |
|
||||
DirectoryOwnership::UnownedViaMod(_) => None,
|
||||
DirectoryOwnership::UnownedViaMod => None,
|
||||
};
|
||||
let paths = Parser::default_submod_path(
|
||||
id, relative, &self.directory.path, self.sess.source_map());
|
||||
@ -169,12 +160,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
Err(err)
|
||||
}
|
||||
DirectoryOwnership::UnownedViaMod(warn) => {
|
||||
if warn {
|
||||
if let Ok(result) = paths.result {
|
||||
return Ok(ModulePathSuccess { warn: true, ..result });
|
||||
}
|
||||
}
|
||||
DirectoryOwnership::UnownedViaMod => {
|
||||
let mut err = self.diagnostic().struct_span_err(id_sp,
|
||||
"cannot declare a new module at this location");
|
||||
if !id_sp.is_dummy() {
|
||||
@ -252,14 +238,12 @@ impl<'a> Parser<'a> {
|
||||
directory_ownership: DirectoryOwnership::Owned {
|
||||
relative: Some(id),
|
||||
},
|
||||
warn: false,
|
||||
}),
|
||||
(false, true) => Ok(ModulePathSuccess {
|
||||
path: secondary_path,
|
||||
directory_ownership: DirectoryOwnership::Owned {
|
||||
relative: None,
|
||||
},
|
||||
warn: false,
|
||||
}),
|
||||
(false, false) => Err(Error::FileNotFoundForModule {
|
||||
mod_name: mod_name.clone(),
|
||||
|
@ -1301,7 +1301,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||
Some(_) => DirectoryOwnership::Owned {
|
||||
relative: Some(item.ident),
|
||||
},
|
||||
None => DirectoryOwnership::UnownedViaMod(false),
|
||||
None => DirectoryOwnership::UnownedViaMod,
|
||||
};
|
||||
path.pop();
|
||||
module.directory = path;
|
||||
|
@ -739,7 +739,6 @@ symbols! {
|
||||
visible_private_types,
|
||||
volatile,
|
||||
warn,
|
||||
warn_directory_ownership,
|
||||
wasm_import_module,
|
||||
wasm_target_feature,
|
||||
while_let,
|
||||
|
@ -15,7 +15,7 @@ mod inline {
|
||||
//~^ ERROR attribute should be applied to function or closure
|
||||
|
||||
#[inline = "2100"] fn f() { }
|
||||
//~^ WARN attribute must be of the form
|
||||
//~^ ERROR attribute must be of the form
|
||||
//~| WARN this was previously accepted
|
||||
|
||||
#[inline] struct S;
|
||||
|
@ -1,10 +1,10 @@
|
||||
warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
|
||||
error: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
|
||||
--> $DIR/issue-43106-gating-of-inline.rs:17:5
|
||||
|
|
||||
LL | #[inline = "2100"] fn f() { }
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(ill_formed_attribute_input)]` on by default
|
||||
= note: `#[deny(ill_formed_attribute_input)]` 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!
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
|
||||
@ -47,6 +47,6 @@ error[E0518]: attribute should be applied to function or closure
|
||||
LL | #[inline] impl S { }
|
||||
| ^^^^^^^^^ ---------- not a function or closure
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0518`.
|
||||
|
@ -1,42 +1,17 @@
|
||||
// rust-lang/rust#57979 : the initial support for `impl Trait` didn't
|
||||
// properly check syntax hidden behind an associated type projection,
|
||||
// but it did catch *some cases*. This is checking that we continue to
|
||||
// properly emit errors for those, even with the new
|
||||
// future-incompatibility warnings.
|
||||
// properly emit errors for those.
|
||||
//
|
||||
// issue-57979-nested-impl-trait-in-assoc-proj.rs shows the main case
|
||||
// that we were previously failing to catch.
|
||||
|
||||
struct Deeper<T>(T);
|
||||
|
||||
mod allowed {
|
||||
#![allow(nested_impl_trait)]
|
||||
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=super::Deeper<impl Foo<impl Bar>>>) { }
|
||||
//~^ ERROR nested `impl Trait` is not allowed
|
||||
}
|
||||
|
||||
mod warned {
|
||||
#![warn(nested_impl_trait)]
|
||||
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=super::Deeper<impl Foo<impl Bar>>>) { }
|
||||
//~^ ERROR nested `impl Trait` is not allowed
|
||||
}
|
||||
|
||||
mod denied {
|
||||
#![deny(nested_impl_trait)]
|
||||
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=super::Deeper<impl Foo<impl Bar>>>) { }
|
||||
//~^ ERROR nested `impl Trait` is not allowed
|
||||
}
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=Deeper<impl Foo<impl Bar>>>) { }
|
||||
//~^ ERROR nested `impl Trait` is not allowed
|
||||
|
||||
fn main() { }
|
||||
|
@ -1,30 +1,12 @@
|
||||
error[E0666]: nested `impl Trait` is not allowed
|
||||
--> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:18:59
|
||||
--> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:14:48
|
||||
|
|
||||
LL | pub fn demo(_: impl Quux<Assoc=super::Deeper<impl Foo<impl Bar>>>) { }
|
||||
| ---------^^^^^^^^-
|
||||
| | |
|
||||
| | nested `impl Trait` here
|
||||
| outer `impl Trait`
|
||||
LL | pub fn demo(_: impl Quux<Assoc=Deeper<impl Foo<impl Bar>>>) { }
|
||||
| ---------^^^^^^^^-
|
||||
| | |
|
||||
| | nested `impl Trait` here
|
||||
| outer `impl Trait`
|
||||
|
||||
error[E0666]: nested `impl Trait` is not allowed
|
||||
--> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:28:59
|
||||
|
|
||||
LL | pub fn demo(_: impl Quux<Assoc=super::Deeper<impl Foo<impl Bar>>>) { }
|
||||
| ---------^^^^^^^^-
|
||||
| | |
|
||||
| | nested `impl Trait` here
|
||||
| outer `impl Trait`
|
||||
|
||||
error[E0666]: nested `impl Trait` is not allowed
|
||||
--> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:38:59
|
||||
|
|
||||
LL | pub fn demo(_: impl Quux<Assoc=super::Deeper<impl Foo<impl Bar>>>) { }
|
||||
| ---------^^^^^^^^-
|
||||
| | |
|
||||
| | nested `impl Trait` here
|
||||
| outer `impl Trait`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0666`.
|
||||
|
@ -3,35 +3,10 @@
|
||||
// Here we test behavior of occurrences of `impl Trait` within a path
|
||||
// component in that context.
|
||||
|
||||
mod allowed {
|
||||
#![allow(nested_impl_trait)]
|
||||
|
||||
pub trait Bar { }
|
||||
pub trait Quux<T> { type Assoc; }
|
||||
pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { }
|
||||
impl<T> Quux<T> for () { type Assoc = u32; }
|
||||
}
|
||||
|
||||
mod warned {
|
||||
#![warn(nested_impl_trait)]
|
||||
|
||||
pub trait Bar { }
|
||||
pub trait Quux<T> { type Assoc; }
|
||||
pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { }
|
||||
//~^ WARN `impl Trait` is not allowed in path parameters
|
||||
//~| WARN will become a hard error in a future release!
|
||||
impl<T> Quux<T> for () { type Assoc = u32; }
|
||||
}
|
||||
|
||||
mod denied {
|
||||
#![deny(nested_impl_trait)]
|
||||
|
||||
pub trait Bar { }
|
||||
pub trait Quux<T> { type Assoc; }
|
||||
pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { }
|
||||
//~^ ERROR `impl Trait` is not allowed in path parameters
|
||||
//~| WARN will become a hard error in a future release!
|
||||
impl<T> Quux<T> for () { type Assoc = u32; }
|
||||
}
|
||||
pub trait Bar { }
|
||||
pub trait Quux<T> { type Assoc; }
|
||||
pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { }
|
||||
//~^ ERROR `impl Trait` is not allowed in path parameters
|
||||
impl<T> Quux<T> for () { type Assoc = u32; }
|
||||
|
||||
fn main() { }
|
||||
|
@ -1,30 +1,8 @@
|
||||
warning: `impl Trait` is not allowed in path parameters
|
||||
--> $DIR/issue-57979-impl-trait-in-path.rs:20:52
|
||||
error[E0667]: `impl Trait` is not allowed in path parameters
|
||||
--> $DIR/issue-57979-impl-trait-in-path.rs:8:48
|
||||
|
|
||||
LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { }
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-57979-impl-trait-in-path.rs:16:13
|
||||
|
|
||||
LL | #![warn(nested_impl_trait)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #59014 <https://github.com/rust-lang/rust/issues/59014>
|
||||
|
||||
error: `impl Trait` is not allowed in path parameters
|
||||
--> $DIR/issue-57979-impl-trait-in-path.rs:31:52
|
||||
|
|
||||
LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { }
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-57979-impl-trait-in-path.rs:27:13
|
||||
|
|
||||
LL | #![deny(nested_impl_trait)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #59014 <https://github.com/rust-lang/rust/issues/59014>
|
||||
LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { }
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,35 +3,10 @@
|
||||
// Here we test behavior of occurrences of `impl Trait` within an
|
||||
// `impl Trait` in that context.
|
||||
|
||||
mod allowed {
|
||||
#![allow(nested_impl_trait)]
|
||||
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=impl Foo<impl Bar>>) { }
|
||||
}
|
||||
|
||||
mod warned {
|
||||
#![warn(nested_impl_trait)]
|
||||
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=impl Foo<impl Bar>>) { }
|
||||
//~^ WARN nested `impl Trait` is not allowed
|
||||
//~| WARN will become a hard error in a future release!
|
||||
}
|
||||
|
||||
mod denied {
|
||||
#![deny(nested_impl_trait)]
|
||||
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=impl Foo<impl Bar>>) { }
|
||||
//~^ ERROR nested `impl Trait` is not allowed
|
||||
//~| WARN will become a hard error in a future release!
|
||||
}
|
||||
pub trait Foo<T> { }
|
||||
pub trait Bar { }
|
||||
pub trait Quux { type Assoc; }
|
||||
pub fn demo(_: impl Quux<Assoc=impl Foo<impl Bar>>) { }
|
||||
//~^ ERROR nested `impl Trait` is not allowed
|
||||
|
||||
fn main() { }
|
||||
|
@ -1,36 +1,12 @@
|
||||
warning: nested `impl Trait` is not allowed
|
||||
--> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:21:45
|
||||
error[E0666]: nested `impl Trait` is not allowed
|
||||
--> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:9:41
|
||||
|
|
||||
LL | pub fn demo(_: impl Quux<Assoc=impl Foo<impl Bar>>) { }
|
||||
| ---------^^^^^^^^-
|
||||
| | |
|
||||
| | nested `impl Trait` here
|
||||
| outer `impl Trait`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:16:13
|
||||
|
|
||||
LL | #![warn(nested_impl_trait)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #59014 <https://github.com/rust-lang/rust/issues/59014>
|
||||
|
||||
error: nested `impl Trait` is not allowed
|
||||
--> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:32:45
|
||||
|
|
||||
LL | pub fn demo(_: impl Quux<Assoc=impl Foo<impl Bar>>) { }
|
||||
| ---------^^^^^^^^-
|
||||
| | |
|
||||
| | nested `impl Trait` here
|
||||
| outer `impl Trait`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:27:13
|
||||
|
|
||||
LL | #![deny(nested_impl_trait)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #59014 <https://github.com/rust-lang/rust/issues/59014>
|
||||
LL | pub fn demo(_: impl Quux<Assoc=impl Foo<impl Bar>>) { }
|
||||
| ---------^^^^^^^^-
|
||||
| | |
|
||||
| | nested `impl Trait` here
|
||||
| outer `impl Trait`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0666`.
|
||||
|
@ -1,7 +0,0 @@
|
||||
#![allow(duplicate_macro_exports)]
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! foo_modern { ($i:ident) => {} }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! foo_modern { () => {} }
|
@ -1,7 +0,0 @@
|
||||
#![allow(duplicate_macro_exports)]
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! foo { ($i:ident) => {} }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! foo { () => {} }
|
@ -1,10 +1,7 @@
|
||||
#![allow(safe_extern_statics, warnings)]
|
||||
|
||||
extern {
|
||||
pub static symbol: u32;
|
||||
}
|
||||
static CRASH: u32 = symbol;
|
||||
//~^ ERROR could not evaluate static initializer
|
||||
//~| tried to read from foreign (extern) static
|
||||
//~^ ERROR use of extern static is unsafe and requires
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,9 +1,11 @@
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $DIR/issue-14227.rs:6:21
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-14227.rs:4:21
|
||||
|
|
||||
LL | static CRASH: u32 = symbol;
|
||||
| ^^^^^^ tried to read from foreign (extern) static
|
||||
| ^^^^^^ use of extern static
|
||||
|
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![allow(safe_extern_statics)]
|
||||
|
||||
mod Y {
|
||||
pub type X = usize;
|
||||
extern {
|
||||
@ -13,5 +11,6 @@ mod Y {
|
||||
static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
//~^ ERROR `*const usize` cannot be shared between threads safely [E0277]
|
||||
//~| ERROR E0015
|
||||
//~| ERROR use of extern static is unsafe and requires
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
|
||||
--> $DIR/issue-16538.rs:13:27
|
||||
--> $DIR/issue-16538.rs:11:27
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `*const usize` cannot be shared between threads safely
|
||||
--> $DIR/issue-16538.rs:13:1
|
||||
--> $DIR/issue-16538.rs:11:1
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely
|
||||
@ -13,7 +13,15 @@ LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
= help: the trait `std::marker::Sync` is not implemented for `*const usize`
|
||||
= note: shared static variables must have a type that implements `Sync`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-16538.rs:11:34
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^ use of extern static
|
||||
|
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
Some errors have detailed explanations: E0015, E0277.
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0133, E0277.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
@ -1,11 +1,8 @@
|
||||
#![allow(safe_extern_statics)]
|
||||
|
||||
extern {
|
||||
static error_message_count: u32;
|
||||
}
|
||||
|
||||
pub static BAZ: u32 = *&error_message_count;
|
||||
//~^ ERROR could not evaluate static initializer
|
||||
//~| tried to read from foreign (extern) static
|
||||
//~^ ERROR use of extern static is unsafe and requires
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,9 +1,11 @@
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $DIR/issue-28324.rs:7:23
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28324.rs:5:24
|
||||
|
|
||||
LL | pub static BAZ: u32 = *&error_message_count;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ tried to read from foreign (extern) static
|
||||
| ^^^^^^^^^^^^^^^^^^^^ use of extern static
|
||||
|
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
@ -1,13 +1,9 @@
|
||||
#![allow(unused)]
|
||||
|
||||
fn main() {
|
||||
{ fn f<X: ::std::marker()::Send>() {} }
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
|
||||
{ fn f() -> impl ::std::marker()::Send { } }
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -15,4 +11,3 @@ struct X;
|
||||
|
||||
impl ::std::marker()::Copy for X {}
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
|
@ -1,30 +1,21 @@
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995-2.rs:4:22
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995-2.rs:2:22
|
||||
|
|
||||
LL | { fn f<X: ::std::marker()::Send>() {} }
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `#[deny(parenthesized_params_in_types_and_modules)]` 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!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995-2.rs:8:29
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995-2.rs:5:29
|
||||
|
|
||||
LL | { fn f() -> impl ::std::marker()::Send { } }
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995-2.rs:16:13
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995-2.rs:12:13
|
||||
|
|
||||
LL | impl ::std::marker()::Copy for X {}
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0214`.
|
||||
|
@ -1,33 +1,24 @@
|
||||
#![allow(unused)]
|
||||
|
||||
fn main() {
|
||||
let x: usize() = 1;
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
|
||||
let b: ::std::boxed()::Box<_> = Box::new(1);
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
|
||||
let p = ::std::str::()::from_utf8(b"foo").unwrap();
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
|
||||
let p = ::std::str::from_utf8::()(b"foo").unwrap();
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
|
||||
let o : Box<dyn (::std::marker()::Send)> = Box::new(1);
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
|
||||
let o : Box<dyn Send + ::std::marker()::Sync> = Box::new(1);
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
}
|
||||
|
||||
fn foo<X:Default>() {
|
||||
let d : X() = Default::default();
|
||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| WARN previously accepted
|
||||
}
|
||||
|
@ -1,66 +1,45 @@
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:4:12
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:2:12
|
||||
|
|
||||
LL | let x: usize() = 1;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `#[deny(parenthesized_params_in_types_and_modules)]` 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!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:8:19
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:5:19
|
||||
|
|
||||
LL | let b: ::std::boxed()::Box<_> = Box::new(1);
|
||||
| ^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:12:20
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:8:20
|
||||
|
|
||||
LL | let p = ::std::str::()::from_utf8(b"foo").unwrap();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:16:25
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:11:25
|
||||
|
|
||||
LL | let p = ::std::str::from_utf8::()(b"foo").unwrap();
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:20:29
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:14:29
|
||||
|
|
||||
LL | let o : Box<dyn (::std::marker()::Send)> = Box::new(1);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:24:35
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:17:35
|
||||
|
|
||||
LL | let o : Box<dyn Send + ::std::marker()::Sync> = Box::new(1);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:30:13
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-32995.rs:22:13
|
||||
|
|
||||
LL | let d : X() = Default::default();
|
||||
| ^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0214`.
|
||||
|
@ -1,15 +0,0 @@
|
||||
// run-pass
|
||||
// aux-build:issue-38715.rs
|
||||
// aux-build:issue-38715-modern.rs
|
||||
|
||||
// Test that `#[macro_export] macro_rules!` shadow earlier `#[macro_export] macro_rules!`
|
||||
|
||||
#[macro_use]
|
||||
extern crate issue_38715;
|
||||
#[macro_use]
|
||||
extern crate issue_38715_modern;
|
||||
|
||||
fn main() {
|
||||
foo!();
|
||||
foo_modern!();
|
||||
}
|
@ -3,6 +3,5 @@ macro_rules! foo { ($i:ident) => {} }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported
|
||||
//~| WARN this was previously accepted
|
||||
|
||||
fn main() {}
|
||||
|
@ -4,9 +4,6 @@ error: a macro named `foo` has already been exported
|
||||
LL | macro_rules! foo { () => {} }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` already exported
|
||||
|
|
||||
= note: `#[deny(duplicate_macro_exports)]` on by default
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
|
||||
= note: for more information, see issue #35896 <https://github.com/rust-lang/rust/issues/35896>
|
||||
note: previous macro export is now shadowed
|
||||
--> $DIR/issue-38715.rs:2:1
|
||||
|
|
||||
|
@ -1,18 +1,12 @@
|
||||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
#[doc] //~ ERROR attribute must be of the form
|
||||
//~^ WARN this was previously accepted
|
||||
#[ignore()] //~ ERROR attribute must be of the form
|
||||
//~^ WARN this was previously accepted
|
||||
#[inline = ""] //~ ERROR attribute must be of the form
|
||||
//~^ WARN this was previously accepted
|
||||
#[link] //~ ERROR attribute must be of the form
|
||||
//~^ WARN this was previously accepted
|
||||
#[link = ""] //~ ERROR attribute must be of the form
|
||||
//~^ WARN this was previously accepted
|
||||
|
||||
#[doc]
|
||||
//~^ WARN attribute must be of the form
|
||||
//~| WARN this was previously accepted
|
||||
#[ignore()]
|
||||
//~^ WARN attribute must be of the form
|
||||
//~| WARN this was previously accepted
|
||||
#[inline = ""]
|
||||
//~^ WARN attribute must be of the form
|
||||
//~| WARN this was previously accepted
|
||||
#[link]
|
||||
//~^WARN attribute must be of the form
|
||||
//~| WARN this was previously accepted
|
||||
#[link = ""]
|
||||
//~^ WARN attribute must be of the form
|
||||
//~| WARN this was previously accepted
|
||||
fn main() {}
|
||||
|
@ -1,15 +1,15 @@
|
||||
warning: attribute must be of the form `#[doc(hidden|inline|...)]` or `#[doc = "string"]`
|
||||
--> $DIR/malformed-regressions.rs:3:1
|
||||
error: attribute must be of the form `#[doc(hidden|inline|...)]` or `#[doc = "string"]`
|
||||
--> $DIR/malformed-regressions.rs:1:1
|
||||
|
|
||||
LL | #[doc]
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `#[warn(ill_formed_attribute_input)]` on by default
|
||||
= note: `#[deny(ill_formed_attribute_input)]` 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!
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
|
||||
warning: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]`
|
||||
--> $DIR/malformed-regressions.rs:6:1
|
||||
error: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]`
|
||||
--> $DIR/malformed-regressions.rs:3:1
|
||||
|
|
||||
LL | #[ignore()]
|
||||
| ^^^^^^^^^^^
|
||||
@ -17,8 +17,8 @@ LL | #[ignore()]
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
|
||||
warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
|
||||
--> $DIR/malformed-regressions.rs:9:1
|
||||
error: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
|
||||
--> $DIR/malformed-regressions.rs:5:1
|
||||
|
|
||||
LL | #[inline = ""]
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -26,8 +26,8 @@ LL | #[inline = ""]
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
|
||||
warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]`
|
||||
--> $DIR/malformed-regressions.rs:12:1
|
||||
error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]`
|
||||
--> $DIR/malformed-regressions.rs:7:1
|
||||
|
|
||||
LL | #[link]
|
||||
| ^^^^^^^
|
||||
@ -35,8 +35,8 @@ LL | #[link]
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
|
||||
warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]`
|
||||
--> $DIR/malformed-regressions.rs:15:1
|
||||
error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]`
|
||||
--> $DIR/malformed-regressions.rs:9:1
|
||||
|
|
||||
LL | #[link = ""]
|
||||
| ^^^^^^^^^^^^
|
||||
@ -44,3 +44,5 @@ LL | #[link = ""]
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
use m::S;
|
||||
|
||||
mod m {
|
||||
@ -11,8 +7,7 @@ mod m {
|
||||
use S;
|
||||
fn f() {
|
||||
S(10);
|
||||
//~^ ERROR private struct constructors are not usable through re-exports in outer modules
|
||||
//~| WARN this was previously accepted
|
||||
//~^ ERROR expected function, tuple struct or tuple variant, found struct `S`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
error: private struct constructors are not usable through re-exports in outer modules
|
||||
--> $DIR/legacy-ctor-visibility.rs:13:13
|
||||
error[E0423]: expected function, tuple struct or tuple variant, found struct `S`
|
||||
--> $DIR/legacy-ctor-visibility.rs:9:13
|
||||
|
|
||||
LL | S(10);
|
||||
| ^
|
||||
|
|
||||
= note: `#[deny(legacy_constructor_visibility)]` 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!
|
||||
= note: for more information, see issue #39207 <https://github.com/rust-lang/rust/issues/39207>
|
||||
LL | / fn f() {
|
||||
LL | | S(10);
|
||||
| | ^ help: a function with a similar name exists: `f`
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_________- similarly named function `f` defined here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0423`.
|
||||
|
@ -1,7 +1,5 @@
|
||||
// aux-build:extern-statics.rs
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
extern crate extern_statics;
|
||||
use extern_statics::*;
|
||||
|
||||
@ -11,11 +9,7 @@ extern {
|
||||
|
||||
fn main() {
|
||||
let a = A; //~ ERROR use of extern static is unsafe
|
||||
//~^ WARN this was previously accepted by the compiler
|
||||
let ra = &A; //~ ERROR use of extern static is unsafe
|
||||
//~^ WARN this was previously accepted by the compiler
|
||||
let xa = XA; //~ ERROR use of extern static is unsafe
|
||||
//~^ WARN this was previously accepted by the compiler
|
||||
let xra = &XA; //~ ERROR use of extern static is unsafe
|
||||
//~^ WARN this was previously accepted by the compiler
|
||||
}
|
||||
|
@ -1,43 +1,35 @@
|
||||
error: use of extern static is unsafe and requires unsafe function or block (error E0133)
|
||||
--> $DIR/safe-extern-statics.rs:13:13
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:11:13
|
||||
|
|
||||
LL | let a = A;
|
||||
| ^
|
||||
| ^ use of extern static
|
||||
|
|
||||
= note: `#[deny(safe_extern_statics)]` 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!
|
||||
= note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: use of extern static is unsafe and requires unsafe function or block (error E0133)
|
||||
--> $DIR/safe-extern-statics.rs:15:14
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:12:14
|
||||
|
|
||||
LL | let ra = &A;
|
||||
| ^^
|
||||
| ^^ use of extern static
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: use of extern static is unsafe and requires unsafe function or block (error E0133)
|
||||
--> $DIR/safe-extern-statics.rs:17:14
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:13:14
|
||||
|
|
||||
LL | let xa = XA;
|
||||
| ^^
|
||||
| ^^ use of extern static
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: use of extern static is unsafe and requires unsafe function or block (error E0133)
|
||||
--> $DIR/safe-extern-statics.rs:19:15
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:14:15
|
||||
|
|
||||
LL | let xra = &XA;
|
||||
| ^^^
|
||||
| ^^^ use of extern static
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
@ -1,9 +1,9 @@
|
||||
pub fn foo(num: i32) -> i32 {
|
||||
let foo: i32::from_be(num);
|
||||
//~^ ERROR expected type, found local variable `num`
|
||||
//~| ERROR type arguments are not allowed for this type
|
||||
//~| ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| ERROR ambiguous associated type
|
||||
//~| WARNING this was previously accepted by the compiler but is being phased out
|
||||
foo
|
||||
}
|
||||
|
||||
|
@ -6,15 +6,20 @@ LL | let foo: i32::from_be(num);
|
||||
| |
|
||||
| help: use `=` if you meant to assign
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/let-binding-init-expr-as-ty.rs:2:19
|
||||
|
|
||||
LL | let foo: i32::from_be(num);
|
||||
| ^^^^^^^^^^^^
|
||||
| |
|
||||
| only `Fn` traits may use parentheses
|
||||
| help: use angle brackets instead: `from_be<num>`
|
||||
|
||||
error[E0109]: type arguments are not allowed for this type
|
||||
--> $DIR/let-binding-init-expr-as-ty.rs:2:27
|
||||
|
|
||||
= note: `#[deny(parenthesized_params_in_types_and_modules)]` 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!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
LL | let foo: i32::from_be(num);
|
||||
| ^^^ type argument not allowed
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/let-binding-init-expr-as-ty.rs:2:14
|
||||
@ -22,7 +27,7 @@ error[E0223]: ambiguous associated type
|
||||
LL | let foo: i32::from_be(num);
|
||||
| ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<i32 as Trait>::from_be`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0223, E0573.
|
||||
For more information about an error, try `rustc --explain E0223`.
|
||||
Some errors have detailed explanations: E0109, E0214, E0223, E0573.
|
||||
For more information about an error, try `rustc --explain E0109`.
|
||||
|
@ -8,7 +8,6 @@ impl Reactor {
|
||||
//~^ ERROR cannot find value `input_cells` in this scope
|
||||
//~| ERROR parenthesized type parameters may only be used with a `Fn` trait
|
||||
//~| ERROR wrong number of type arguments: expected 1, found 0
|
||||
//~| WARNING this was previously accepted by the compiler but is being phased out
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,15 +4,11 @@ error[E0425]: cannot find value `input_cells` in this scope
|
||||
LL | input_cells: Vec::new()
|
||||
| ^^^^^^^^^^^ a field by this name exists in `Self`
|
||||
|
||||
error: parenthesized type parameters may only be used with a `Fn` trait
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/issue-34255-1.rs:7:27
|
||||
|
|
||||
LL | input_cells: Vec::new()
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `#[deny(parenthesized_params_in_types_and_modules)]` 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!
|
||||
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
|
||||
| ^^^^^ only `Fn` traits may use parentheses
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 1, found 0
|
||||
--> $DIR/issue-34255-1.rs:7:22
|
||||
@ -22,5 +18,5 @@ LL | input_cells: Vec::new()
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0425.
|
||||
Some errors have detailed explanations: E0107, E0214, E0425.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
|
Loading…
Reference in New Issue
Block a user