Auto merge of #42894 - petrochenkov:deny, r=nikomatsakis
Make sufficiently old or low-impact compatibility lints deny-by-default Needs crater run before proceeding. r? @nikomatsakis
This commit is contained in:
commit
fb4fa6080f
57 changed files with 101 additions and 130 deletions
|
|
@ -614,7 +614,7 @@ use std::mem::transmute;
|
|||
struct Foo<T>(Vec<T>);
|
||||
|
||||
trait MyTransmutableType: Sized {
|
||||
fn transmute(Vec<Self>) -> Foo<Self>;
|
||||
fn transmute(_: Vec<Self>) -> Foo<Self>;
|
||||
}
|
||||
|
||||
impl MyTransmutableType for u8 {
|
||||
|
|
|
|||
|
|
@ -130,6 +130,12 @@ declare_lint! {
|
|||
"detect private items in public interfaces not caught by the old implementation"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
||||
Deny,
|
||||
"detect public reexports of private extern crates"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub INVALID_TYPE_PARAM_DEFAULT,
|
||||
Deny,
|
||||
|
|
@ -144,14 +150,14 @@ declare_lint! {
|
|||
|
||||
declare_lint! {
|
||||
pub RESOLVE_TRAIT_ON_DEFAULTED_UNIT,
|
||||
Warn,
|
||||
Deny,
|
||||
"attempt to resolve a trait on an expression whose type cannot be inferred but which \
|
||||
currently defaults to ()"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub SAFE_EXTERN_STATICS,
|
||||
Warn,
|
||||
Deny,
|
||||
"safe access to extern statics was erroneously allowed"
|
||||
}
|
||||
|
||||
|
|
@ -169,14 +175,14 @@ declare_lint! {
|
|||
|
||||
declare_lint! {
|
||||
pub LEGACY_DIRECTORY_OWNERSHIP,
|
||||
Warn,
|
||||
Deny,
|
||||
"non-inline, non-`#[path]` modules (e.g. `mod foo;`) were erroneously allowed in some files \
|
||||
not named `mod.rs`"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub LEGACY_IMPORTS,
|
||||
Warn,
|
||||
Deny,
|
||||
"detects names that resolve to ambiguous glob imports with RFC 1560"
|
||||
}
|
||||
|
||||
|
|
@ -188,13 +194,13 @@ declare_lint! {
|
|||
|
||||
declare_lint! {
|
||||
pub MISSING_FRAGMENT_SPECIFIER,
|
||||
Warn,
|
||||
Deny,
|
||||
"detects missing fragment specifiers in unused `macro_rules!` patterns"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
|
||||
Warn,
|
||||
Deny,
|
||||
"detects parenthesized generic parameters in type and module names"
|
||||
}
|
||||
|
||||
|
|
@ -230,6 +236,7 @@ impl LintPass for HardwiredLints {
|
|||
TRIVIAL_CASTS,
|
||||
TRIVIAL_NUMERIC_CASTS,
|
||||
PRIVATE_IN_PUBLIC,
|
||||
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
||||
INVALID_TYPE_PARAM_DEFAULT,
|
||||
CONST_ERR,
|
||||
RENAMED_AND_REMOVED_LINTS,
|
||||
|
|
|
|||
|
|
@ -184,6 +184,10 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
|
|||
id: LintId::of(PRIVATE_IN_PUBLIC),
|
||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(PUB_USE_OF_PRIVATE_EXTERN_CRATE),
|
||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||
},
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(PATTERNS_IN_FNS_WITHOUT_BODY),
|
||||
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ impl Something {} // ok!
|
|||
trait Foo {
|
||||
type N;
|
||||
|
||||
fn bar(Self::N); // ok!
|
||||
fn bar(_: Self::N); // ok!
|
||||
}
|
||||
|
||||
// or:
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use {names_to_string, module_to_string};
|
|||
use {resolve_error, ResolutionError};
|
||||
|
||||
use rustc::ty;
|
||||
use rustc::lint::builtin::PRIVATE_IN_PUBLIC;
|
||||
use rustc::lint::builtin::PUB_USE_OF_PRIVATE_EXTERN_CRATE;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::def::*;
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
|
|
@ -296,7 +296,8 @@ impl<'a> Resolver<'a> {
|
|||
pub fn import(&self, binding: &'a NameBinding<'a>, directive: &'a ImportDirective<'a>)
|
||||
-> &'a NameBinding<'a> {
|
||||
let vis = if binding.pseudo_vis().is_at_least(directive.vis.get(), self) ||
|
||||
!directive.is_glob() && binding.is_extern_crate() { // c.f. `PRIVATE_IN_PUBLIC`
|
||||
// c.f. `PUB_USE_OF_PRIVATE_EXTERN_CRATE`
|
||||
!directive.is_glob() && binding.is_extern_crate() {
|
||||
directive.vis.get()
|
||||
} else {
|
||||
binding.pseudo_vis()
|
||||
|
|
@ -735,7 +736,8 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
|||
let msg = format!("extern crate `{}` is private, and cannot be reexported \
|
||||
(error E0365), consider declaring with `pub`",
|
||||
ident);
|
||||
self.session.add_lint(PRIVATE_IN_PUBLIC, directive.id, directive.span, msg);
|
||||
self.session.add_lint(PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
||||
directive.id, directive.span, msg);
|
||||
} else if ns == TypeNS {
|
||||
struct_span_err!(self.session, directive.span, E0365,
|
||||
"`{}` is private, and cannot be reexported", ident)
|
||||
|
|
|
|||
|
|
@ -2476,7 +2476,7 @@ trait T2 {
|
|||
type Bar;
|
||||
|
||||
// error: Baz is used but not declared
|
||||
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
|
||||
fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -2498,7 +2498,7 @@ trait T2 {
|
|||
type Baz; // we declare `Baz` in our trait.
|
||||
|
||||
// and now we can use it here:
|
||||
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
|
||||
fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
|
||||
}
|
||||
```
|
||||
"##,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub trait Sized {
|
|||
trait Add<RHS=Self> {
|
||||
type Output;
|
||||
|
||||
fn add(self, RHS) -> Self::Output;
|
||||
fn add(self, _: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
fn ice<A>(a: A) {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(unreachable_code)]
|
||||
#![deny(resolve_trait_on_defaulted_unit)]
|
||||
#![allow(unused)]
|
||||
|
||||
trait Deserialize: Sized {
|
||||
fn deserialize() -> Result<Self, String>;
|
||||
|
|
@ -38,4 +36,3 @@ fn smeg() {
|
|||
fn main() {
|
||||
smeg();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,8 @@
|
|||
|
||||
// error-pattern: cannot declare a new module at this location
|
||||
// error-pattern: will become a hard error
|
||||
// error-pattern: compilation successful
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[path="mod_file_not_owning_aux3.rs"]
|
||||
mod foo;
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(unused)]
|
||||
|
||||
pub struct Foo;
|
||||
|
|
@ -20,12 +19,11 @@ mod bar {
|
|||
use *; //~ NOTE `Foo` could refer to the name imported here
|
||||
use bar::*; //~ NOTE `Foo` could also refer to the name imported here
|
||||
fn f(_: Foo) {}
|
||||
//~^ WARN `Foo` is ambiguous
|
||||
//~^ ERROR `Foo` is ambiguous
|
||||
//~| WARN hard error in a future release
|
||||
//~| NOTE see issue #38260
|
||||
//~| NOTE #[warn(legacy_imports)] on by default
|
||||
//~| NOTE #[deny(legacy_imports)] on by default
|
||||
}
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {} //~ ERROR compilation successful
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
trait Deserializer<'a> { }
|
||||
|
||||
trait Deserializable {
|
||||
fn deserialize_token<'a, D: Deserializer<'a>>(D, &'a str) -> Self;
|
||||
fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
|
||||
}
|
||||
|
||||
impl<'a, T: Deserializable> Deserializable for &'a str {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait Set<T> {
|
||||
fn contains(&self, T) -> bool;
|
||||
fn set(&mut self, T);
|
||||
fn contains(&self, _: T) -> bool;
|
||||
fn set(&mut self, _: T);
|
||||
}
|
||||
|
||||
impl<'a, T, S> Set<&'a [T]> for S where
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub trait Subscriber {
|
|||
|
||||
pub trait Publisher<'a> {
|
||||
type Output;
|
||||
fn subscribe(&mut self, Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
}
|
||||
|
||||
pub trait Processor<'a> : Subscriber + Publisher<'a> { }
|
||||
|
|
|
|||
|
|
@ -8,23 +8,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(parenthesized_params_in_types_and_modules)]
|
||||
//~^ NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
#![allow(dead_code, unused_variables)]
|
||||
#![feature(conservative_impl_trait)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn main() {
|
||||
{ fn f<X: ::std::marker()::Send>() {} }
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
|
||||
{ fn f() -> impl ::std::marker()::Send { } }
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
@ -33,4 +27,3 @@ struct X;
|
|||
impl ::std::marker()::Copy for X {}
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
|
|
|
|||
|
|
@ -8,26 +8,16 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(parenthesized_params_in_types_and_modules)]
|
||||
//~^ NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
#![allow(dead_code, unused_variables)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn main() {
|
||||
let x: usize() = 1;
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
|
||||
let b: ::std::boxed()::Box<_> = Box::new(1);
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
|
||||
macro_rules! pathexpr {
|
||||
($p:path) => { $p }
|
||||
|
|
@ -36,27 +26,22 @@ fn main() {
|
|||
let p = pathexpr!(::std::str()::from_utf8)(b"foo").unwrap();
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
|
||||
let p = pathexpr!(::std::str::from_utf8())(b"foo").unwrap();
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
|
||||
let o : Box<::std::marker()::Send> = Box::new(1);
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
|
||||
let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
}
|
||||
|
||||
fn foo<X:Default>() {
|
||||
let d : X() = Default::default();
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #42238
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
#![feature(conservative_impl_trait)]
|
||||
|
||||
trait Foo {
|
||||
fn foo(fn(u8) -> ()); //~ NOTE type in trait
|
||||
fn bar(Option<u8>); //~ NOTE type in trait
|
||||
fn baz((u8, u16)); //~ NOTE type in trait
|
||||
fn foo(_: fn(u8) -> ()); //~ NOTE type in trait
|
||||
fn bar(_: Option<u8>); //~ NOTE type in trait
|
||||
fn baz(_: (u8, u16)); //~ NOTE type in trait
|
||||
fn qux() -> u8; //~ NOTE type in trait
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
// Test that `fn foo::bar::{self}` only imports `bar` in the type namespace.
|
||||
|
||||
#![allow(unused)]
|
||||
#![deny(legacy_imports)]
|
||||
|
||||
mod foo {
|
||||
pub fn f() { }
|
||||
|
|
|
|||
|
|
@ -8,12 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(missing_fragment_specifier)] //~ NOTE lint level defined here
|
||||
#![allow(unused_macros)]
|
||||
#![allow(unused)]
|
||||
|
||||
macro_rules! m { ($i) => {} }
|
||||
//~^ ERROR missing fragment specifier
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE issue #40107
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ trait Tr {
|
|||
//~^ WARN was previously accepted
|
||||
fn g1(arg: u8); // OK
|
||||
fn g2(_: u8); // OK
|
||||
#[allow(anonymous_parameters)]
|
||||
fn g3(u8); // OK
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![allow(unused)]
|
||||
#![deny(private_in_public)]
|
||||
|
||||
extern crate core;
|
||||
pub use core as reexported_core; //~ ERROR `core` is private, and cannot be reexported
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
// aux-build:extern-statics.rs
|
||||
|
||||
#![allow(unused)]
|
||||
#![deny(safe_extern_statics)]
|
||||
|
||||
extern crate extern_statics;
|
||||
use extern_statics::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
// aux-build:extern-statics.rs
|
||||
|
||||
#![allow(unused)]
|
||||
#![deny(safe_extern_statics)]
|
||||
|
||||
extern crate extern_statics;
|
||||
use extern_statics::*;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
// gate-test-default_type_parameter_fallback
|
||||
|
||||
#![deny(invalid_type_param_default)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn avg<T=i32>(_: T) {}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// type parameters on a trait correctly.
|
||||
|
||||
trait Tr<T> : Sized {
|
||||
fn op(T) -> Self;
|
||||
fn op(_: T) -> Self;
|
||||
}
|
||||
|
||||
trait A: Tr<Self> {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ trait Getter<T> {
|
|||
}
|
||||
|
||||
trait Setter<T> {
|
||||
fn get(&self, T);
|
||||
fn get(&self, _: T);
|
||||
}
|
||||
|
||||
#[rustc_variance]
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub trait Subscriber {
|
|||
|
||||
pub trait Publisher<'a> {
|
||||
type Output;
|
||||
fn subscribe(&mut self, Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
}
|
||||
|
||||
pub trait Processor<'a> : Subscriber + Publisher<'a> { }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#![crate_type = "lib"]
|
||||
|
||||
pub trait Positioned {
|
||||
fn SetX(&mut self, isize);
|
||||
fn SetX(&mut self, _: isize);
|
||||
fn X(&self) -> isize;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub trait FromBuf<'a> {
|
||||
fn from_buf(&'a [u8]) -> Self;
|
||||
fn from_buf(_: &'a [u8]) -> Self;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ pub fn main() {
|
|||
}
|
||||
|
||||
trait Named {
|
||||
fn new(&'static str) -> Self;
|
||||
fn new(_: &'static str) -> Self;
|
||||
fn name(&self) -> &str;
|
||||
}
|
||||
|
||||
|
|
@ -932,9 +932,9 @@ trait Context {
|
|||
}
|
||||
|
||||
trait PrePost<T> {
|
||||
fn pre(&mut self, &T);
|
||||
fn post(&mut self, &T);
|
||||
fn hit_limit(&mut self, &T);
|
||||
fn pre(&mut self, _: &T);
|
||||
fn post(&mut self, _: &T);
|
||||
fn hit_limit(&mut self, _: &T);
|
||||
}
|
||||
|
||||
trait Children<'a> {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
// pretty-expanded FIXME #23616
|
||||
|
||||
trait Foo {
|
||||
#[allow(anonymous_parameters)]
|
||||
fn quux(u8) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
// pretty-expanded FIXME #23616
|
||||
|
||||
trait Foo {
|
||||
#[allow(anonymous_parameters)]
|
||||
fn bar(&self, isize) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> {
|
|||
}
|
||||
|
||||
trait IntoMatcher<'a, T> {
|
||||
fn into_matcher(self, &'a str) -> T;
|
||||
fn into_matcher(self, _: &'a str) -> T;
|
||||
}
|
||||
|
||||
impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub trait Handler {
|
||||
fn handle(&self, &mut String);
|
||||
fn handle(&self, _: &mut String);
|
||||
}
|
||||
|
||||
impl<F> Handler for F where F: for<'a, 'b> Fn(&'a mut String) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ fn foo<'a>(s: &'a str) {
|
|||
|
||||
trait IntoRef<'a> {
|
||||
type T: Clone;
|
||||
fn into_ref(self, &'a str) -> Self::T;
|
||||
fn into_ref(self, _: &'a str) -> Self::T;
|
||||
}
|
||||
|
||||
impl<'a> IntoRef<'a> for () {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Make sure several unnamed function arguments don't conflict with each other
|
||||
// Make sure several unnamed function parameters don't conflict with each other
|
||||
|
||||
trait Tr {
|
||||
#[allow(anonymous_parameters)]
|
||||
fn f(u8, u8) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
use std::ops::Add;
|
||||
|
||||
trait Positioned<S> {
|
||||
fn SetX(&mut self, S);
|
||||
fn SetX(&mut self, _: S);
|
||||
fn X(&self) -> S;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
trait Positioned {
|
||||
fn SetX(&mut self, isize);
|
||||
fn SetX(&mut self, _: isize);
|
||||
fn X(&self) -> isize;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub fn main() {
|
|||
let _id: &Mat2<f64> = &Matrix::identity(1.0);
|
||||
}
|
||||
|
||||
pub trait Index<Index,Result> { fn get(&self, Index) -> Result { panic!() } }
|
||||
pub trait Index<Index,Result> { fn get(&self, _: Index) -> Result { panic!() } }
|
||||
pub trait Dimensional<T>: Index<usize, T> { }
|
||||
|
||||
pub struct Mat2<T> { x: T }
|
||||
|
|
|
|||
|
|
@ -14,9 +14,8 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
trait Graph<Node, Edge> {
|
||||
fn f(&self, Edge);
|
||||
fn g(&self, Node);
|
||||
|
||||
fn f(&self, _: Edge);
|
||||
fn g(&self, _: Node);
|
||||
}
|
||||
|
||||
impl<E> Graph<isize, E> for HashMap<isize, isize> {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
pub trait OpInt { fn call(&mut self, isize, isize) -> isize; }
|
||||
pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; }
|
||||
|
||||
impl<F> OpInt for F where F: FnMut(isize, isize) -> isize {
|
||||
fn call(&mut self, a:isize, b:isize) -> isize {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#![allow(unknown_features)]
|
||||
#![feature(box_syntax)]
|
||||
|
||||
pub trait bomb { fn boom(&self, Ident); }
|
||||
pub trait bomb { fn boom(&self, _: Ident); }
|
||||
pub struct S;
|
||||
impl bomb for S { fn boom(&self, _: Ident) { } }
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ fn main() {
|
|||
// discarded. By adding and calling `other::bar`, we get around this problem.
|
||||
other::bar();
|
||||
|
||||
assert!(!foo.is_null());
|
||||
assert_eq!(unsafe { *foo }, 3);
|
||||
assert!(something_that_should_never_exist.is_null());
|
||||
unsafe {
|
||||
assert!(!foo.is_null());
|
||||
assert_eq!(*foo, 3);
|
||||
assert!(something_that_should_never_exist.is_null());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ fn make_val<T:MakerTrait>() -> T {
|
|||
}
|
||||
|
||||
trait RefMakerTrait<'q> {
|
||||
fn mk(Self) -> &'q Self;
|
||||
fn mk(_: Self) -> &'q Self;
|
||||
}
|
||||
|
||||
fn make_ref<'r, T:RefMakerTrait<'r>>(t:T) -> &'r T {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
use std::ops::Add;
|
||||
|
||||
trait Positioned<S> {
|
||||
fn SetX(&mut self, S);
|
||||
fn SetX(&mut self, _: S);
|
||||
fn X(&self) -> S;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,5 +22,7 @@ extern {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(FOO, 3);
|
||||
unsafe {
|
||||
assert_eq!(FOO, 3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
pub trait MyNum {
|
||||
fn from_int(isize) -> Self;
|
||||
fn from_int(_: isize) -> Self;
|
||||
}
|
||||
|
||||
pub trait NumExt: MyNum { }
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
pub trait MyEq {}
|
||||
|
||||
pub trait MyNum {
|
||||
fn from_int(isize) -> Self;
|
||||
fn from_int(_: isize) -> Self;
|
||||
}
|
||||
|
||||
pub trait NumExt: MyEq + MyNum { }
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl<A1, A2, A3> Impl<A1, A2, A3> {
|
|||
enum Type<T> { Constant(T) }
|
||||
|
||||
trait Trait<K,V> {
|
||||
fn method(&self,Type<(K,V)>) -> isize;
|
||||
fn method(&self, _: Type<(K,V)>) -> isize;
|
||||
}
|
||||
|
||||
impl<V> Trait<u8,V> for () {
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ trait Bound {
|
|||
}
|
||||
|
||||
trait Trait {
|
||||
fn a<T>(&self, T) where T: Bound;
|
||||
fn b<T>(&self, T) where T: Bound;
|
||||
fn c<T: Bound>(&self, T);
|
||||
fn d<T: Bound>(&self, T);
|
||||
fn a<T>(&self, _: T) where T: Bound;
|
||||
fn b<T>(&self, _: T) where T: Bound;
|
||||
fn c<T: Bound>(&self, _: T);
|
||||
fn d<T: Bound>(&self, _: T);
|
||||
}
|
||||
|
||||
impl Trait for bool {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![deny(extra_requirement_in_impl)]
|
||||
|
||||
// Test that we elaborate `Type: 'region` constraints and infer various important things.
|
||||
|
||||
trait Master<'a, T: ?Sized, U> {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/proj-outlives-region.rs:22:5
|
||||
--> $DIR/proj-outlives-region.rs:19:5
|
||||
|
|
||||
17 | fn foo() where T: 'a;
|
||||
14 | fn foo() where T: 'a;
|
||||
| --------------------- definition of `foo` from trait
|
||||
...
|
||||
22 | fn foo() where U: 'a { } //~ ERROR E0276
|
||||
19 | fn foo() where U: 'a { } //~ ERROR E0276
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
|
||||
|
|
||||
= note: #[deny(extra_requirement_in_impl)] on by default
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![deny(extra_requirement_in_impl)]
|
||||
|
||||
// Test that you cannot add an extra where clause in the impl relating
|
||||
// two regions.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/region-extra.rs:22:5
|
||||
--> $DIR/region-extra.rs:19:5
|
||||
|
|
||||
18 | fn foo();
|
||||
15 | fn foo();
|
||||
| --------- definition of `foo` from trait
|
||||
...
|
||||
22 | fn foo() where 'a: 'b { }
|
||||
19 | fn foo() where 'a: 'b { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![deny(extra_requirement_in_impl)]
|
||||
|
||||
// Test that we elaborate `Type: 'region` constraints and infer various important things.
|
||||
|
||||
trait Master<'a, T: ?Sized, U> {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/region-unrelated.rs:22:5
|
||||
--> $DIR/region-unrelated.rs:19:5
|
||||
|
|
||||
17 | fn foo() where T: 'a;
|
||||
14 | fn foo() where T: 'a;
|
||||
| --------------------- definition of `foo` from trait
|
||||
...
|
||||
22 | fn foo() where V: 'a { }
|
||||
19 | fn foo() where V: 'a { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
|
||||
|
|
||||
= note: #[deny(extra_requirement_in_impl)] on by default
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
trait CtxtFn {
|
||||
fn f8(self, usize) -> usize;
|
||||
fn f9(usize) -> usize; //~ NOTE candidate
|
||||
fn f8(self, _: usize) -> usize;
|
||||
fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
}
|
||||
|
||||
trait OtherTrait {
|
||||
fn f9(usize) -> usize; //~ NOTE candidate
|
||||
fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
}
|
||||
|
||||
// Note: this trait is not implemented, but we can't really tell
|
||||
|
|
@ -26,7 +26,7 @@ trait OtherTrait {
|
|||
// candidate. This seems not unreasonable -- perhaps the user meant to
|
||||
// implement it, after all.
|
||||
trait UnusedTrait {
|
||||
fn f9(usize) -> usize; //~ NOTE candidate
|
||||
fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
}
|
||||
|
||||
impl CtxtFn for usize {
|
||||
|
|
|
|||
|
|
@ -8,20 +8,20 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope
|
|||
note: candidate #1 is defined in the trait `CtxtFn`
|
||||
--> $DIR/issue-7575.rs:16:5
|
||||
|
|
||||
16 | fn f9(usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
16 | fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: to disambiguate the method call, write `CtxtFn::f9(u, 342)` instead
|
||||
note: candidate #2 is defined in the trait `OtherTrait`
|
||||
--> $DIR/issue-7575.rs:20:5
|
||||
|
|
||||
20 | fn f9(usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
20 | fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: to disambiguate the method call, write `OtherTrait::f9(u, 342)` instead
|
||||
note: candidate #3 is defined in the trait `UnusedTrait`
|
||||
--> $DIR/issue-7575.rs:29:5
|
||||
|
|
||||
29 | fn f9(usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
29 | fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: to disambiguate the method call, write `UnusedTrait::f9(u, 342)` instead
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `f9`, perhaps you need to implement one of them:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue