Auto merge of #46829 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 11 pull requests

- Successful merges: #46700, #46786, #46790, #46800, #46801, #46802, #46804, #46805, #46812, #46824, #46825
- Failed merges:
This commit is contained in:
bors 2017-12-19 04:21:05 +00:00
commit c8b94c6aa1
45 changed files with 328 additions and 467 deletions

View File

@ -273,10 +273,13 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
/// let n = 0x0123456789ABCDEFi64;
/// let m = -0x1032547698BADCFFi64;
/// let n: i16 = 0b0000000_01010101;
/// assert_eq!(n, 85);
///
/// assert_eq!(n.swap_bytes(), m);
/// let m = n.swap_bytes();
///
/// assert_eq!(m, 0b01010101_00000000);
/// assert_eq!(m, 21760);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
@ -1466,10 +1469,13 @@ macro_rules! uint_impl {
/// Basic usage:
///
/// ```
/// let n = 0x0123456789ABCDEFu64;
/// let m = 0xEFCDAB8967452301u64;
/// let n: u16 = 0b0000000_01010101;
/// assert_eq!(n, 85);
///
/// assert_eq!(n.swap_bytes(), m);
/// let m = n.swap_bytes();
///
/// assert_eq!(m, 0b01010101_00000000);
/// assert_eq!(m, 21760);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]

View File

@ -484,19 +484,16 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
-> DiagnosticBuilder<'tcx>
{
let msg = "impl has stricter requirements than trait";
let mut err = struct_span_err!(self.tcx.sess,
error_span,
E0276,
"{}", msg);
let sp = self.tcx.sess.codemap().def_span(error_span);
let mut err = struct_span_err!(self.tcx.sess, sp, E0276, "{}", msg);
if let Some(trait_item_span) = self.tcx.hir.span_if_local(trait_item_def_id) {
let span = self.tcx.sess.codemap().def_span(trait_item_span);
err.span_label(span, format!("definition of `{}` from trait", item_name));
}
err.span_label(
error_span,
format!("impl has extra requirement {}", requirement));
err.span_label(sp, format!("impl has extra requirement {}", requirement));
err
}
@ -647,7 +644,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
ty::Predicate::ClosureKind(closure_def_id, closure_substs, kind) => {
let found_kind = self.closure_kind(closure_def_id, closure_substs).unwrap();
let closure_span = self.tcx.hir.span_if_local(closure_def_id).unwrap();
let closure_span = self.tcx.sess.codemap()
.def_span(self.tcx.hir.span_if_local(closure_def_id).unwrap());
let node_id = self.tcx.hir.as_local_node_id(closure_def_id).unwrap();
let mut err = struct_span_err!(
self.tcx.sess, closure_span, E0525,
@ -656,6 +654,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
kind,
found_kind);
err.span_label(
closure_span,
format!("this closure implements `{}`, not `{}`", found_kind, kind));
err.span_label(
obligation.cause.span,
format!("the requirement to implement `{}` derives from here", kind));
@ -667,12 +668,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let closure_hir_id = self.tcx.hir.node_to_hir_id(node_id);
match (found_kind, tables.closure_kind_origins().get(closure_hir_id)) {
(ty::ClosureKind::FnOnce, Some((span, name))) => {
err.span_note(*span, &format!(
err.span_label(*span, format!(
"closure is `FnOnce` because it moves the \
variable `{}` out of its environment", name));
},
(ty::ClosureKind::FnMut, Some((span, name))) => {
err.span_note(*span, &format!(
err.span_label(*span, format!(
"closure is `FnMut` because it mutates the \
variable `{}` here", name));
},

View File

@ -341,15 +341,18 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
}),
if used_to_be_allowed { " (E0119)" } else { "" }
);
let impl_span = tcx.sess.codemap().def_span(
tcx.span_of_impl(impl_def_id).unwrap()
);
let mut err = if used_to_be_allowed {
tcx.struct_span_lint_node(
lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS,
tcx.hir.as_local_node_id(impl_def_id).unwrap(),
tcx.span_of_impl(impl_def_id).unwrap(),
impl_span,
&msg)
} else {
struct_span_err!(tcx.sess,
tcx.span_of_impl(impl_def_id).unwrap(),
impl_span,
E0119,
"{}",
msg)
@ -357,8 +360,9 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
match tcx.span_of_impl(overlap.with_impl) {
Ok(span) => {
err.span_label(span, format!("first implementation here"));
err.span_label(tcx.span_of_impl(impl_def_id).unwrap(),
err.span_label(tcx.sess.codemap().def_span(span),
format!("first implementation here"));
err.span_label(impl_span,
format!("conflicting implementation{}",
overlap.self_desc
.map_or(String::new(),

View File

@ -352,7 +352,7 @@ impl MissingDoc {
let has_doc = attrs.iter().any(|a| a.is_value_str() && a.check_name("doc"));
if !has_doc {
cx.span_lint(MISSING_DOCS,
sp,
cx.tcx.sess.codemap().def_span(sp),
&format!("missing documentation for {}", desc));
}
}
@ -914,15 +914,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnconditionalRecursion {
// no break */ }`) shouldn't be linted unless it actually
// recurs.
if !reached_exit_without_self_call && !self_call_spans.is_empty() {
let sp = cx.tcx.sess.codemap().def_span(sp);
let mut db = cx.struct_span_lint(UNCONDITIONAL_RECURSION,
sp,
"function cannot return without recurring");
db.span_label(sp, "cannot return without recurring");
// offer some help to the programmer.
for call in &self_call_spans {
db.span_note(*call, "recursive call site");
db.span_label(*call, "recursive call site");
}
db.help("a `loop` may express intention \
better if this is on purpose");
db.help("a `loop` may express intention better if this is on purpose");
db.emit();
}

View File

@ -388,12 +388,13 @@ fn is_enclosed(tcx: TyCtxt,
}
fn report_unused_unsafe(tcx: TyCtxt, used_unsafe: &FxHashSet<ast::NodeId>, id: ast::NodeId) {
let span = tcx.hir.span(id);
let mut db = tcx.struct_span_lint_node(UNUSED_UNSAFE, id, span, "unnecessary `unsafe` block");
db.span_label(span, "unnecessary `unsafe` block");
let span = tcx.sess.codemap().def_span(tcx.hir.span(id));
let msg = "unnecessary `unsafe` block";
let mut db = tcx.struct_span_lint_node(UNUSED_UNSAFE, id, span, msg);
db.span_label(span, msg);
if let Some((kind, id)) = is_enclosed(tcx, used_unsafe, id) {
db.span_note(tcx.hir.span(id),
&format!("because it's nested under this `unsafe` {}", kind));
db.span_label(tcx.sess.codemap().def_span(tcx.hir.span(id)),
format!("because it's nested under this `unsafe` {}", kind));
}
db.emit();
}

View File

@ -3840,7 +3840,7 @@ impl<'a> Resolver<'a> {
false => "defined",
};
let (name, span) = (ident.name, new_binding.span);
let (name, span) = (ident.name, self.session.codemap().def_span(new_binding.span));
if let Some(s) = self.name_already_seen.get(&name) {
if s == &span {
@ -3885,8 +3885,8 @@ impl<'a> Resolver<'a> {
err.span_label(span, format!("`{}` re{} here", name, new_participle));
if old_binding.span != syntax_pos::DUMMY_SP {
err.span_label(old_binding.span, format!("previous {} of the {} `{}` here",
old_noun, old_kind, name));
err.span_label(self.session.codemap().def_span(old_binding.span),
format!("previous {} of the {} `{}` here", old_noun, old_kind, name));
}
// See https://github.com/rust-lang/rust/issues/32354

View File

@ -406,8 +406,8 @@ pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
let zero = C_null(bcx.ccx.isize_ty());
// `offset == 0`
let is_zero = bcx.icmp(llvm::IntPredicate::IntEQ, offset, zero);
// `if offset == 0 { 0 } else { offset - align }`
bcx.select(is_zero, zero, bcx.sub(offset, align))
// `if offset == 0 { 0 } else { align - offset }`
bcx.select(is_zero, zero, bcx.sub(align, offset))
}
name if name.starts_with("simd_") => {
match generic_simd_intrinsic(bcx, name,

View File

@ -448,8 +448,7 @@ fn build_static(cx: &DocContext, did: DefId, mutable: bool) -> clean::Static {
///
/// The inverse of this filtering logic can be found in the `Clean`
/// implementation for `AssociatedType`
fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics)
-> clean::Generics {
fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean::Generics {
for pred in &mut g.where_predicates {
match *pred {
clean::WherePredicate::BoundPredicate {

View File

@ -1190,16 +1190,36 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
pub struct Generics {
pub lifetimes: Vec<Lifetime>,
pub type_params: Vec<TyParam>,
pub where_predicates: Vec<WherePredicate>
pub where_predicates: Vec<WherePredicate>,
}
impl Clean<Generics> for hir::Generics {
fn clean(&self, cx: &DocContext) -> Generics {
Generics {
let mut g = Generics {
lifetimes: self.lifetimes.clean(cx),
type_params: self.ty_params.clean(cx),
where_predicates: self.where_clause.predicates.clean(cx)
};
// Some duplicates are generated for ?Sized bounds between type params and where
// predicates. The point in here is to move the bounds definitions from type params
// to where predicates when such cases occur.
for where_pred in &mut g.where_predicates {
match *where_pred {
WherePredicate::BoundPredicate { ty: Generic(ref name), ref mut bounds } => {
if bounds.is_empty() {
for type_params in &mut g.type_params {
if &type_params.name == name {
mem::swap(bounds, &mut type_params.bounds);
break
}
}
}
}
_ => continue,
}
}
g
}
}
@ -1225,7 +1245,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
let mut where_predicates = preds.predicates.to_vec().clean(cx);
// Type parameters and have a Sized bound by default unless removed with
// ?Sized. Scan through the predicates and mark any type parameter with
// ?Sized. Scan through the predicates and mark any type parameter with
// a Sized bound, removing the bounds as we find them.
//
// Note that associated types also have a sized bound by default, but we

View File

@ -38,6 +38,7 @@ pub fn where_clauses(cx: &DocContext, clauses: Vec<WP>) -> Vec<WP> {
let mut lifetimes = Vec::new();
let mut equalities = Vec::new();
let mut tybounds = Vec::new();
for clause in clauses {
match clause {
WP::BoundPredicate { ty, bounds } => {

View File

@ -681,6 +681,9 @@
}
function checkPath(startsWith, lastElem, ty) {
if (startsWith.length === 0) {
return 0;
}
var ret_lev = MAX_LEV_DISTANCE + 1;
var path = ty.path.split("::");
@ -706,18 +709,7 @@
lev_total += lev;
}
if (aborted === false) {
var extra = MAX_LEV_DISTANCE + 1;
if (i + startsWith.length < path.length) {
extra = levenshtein(path[i + startsWith.length], lastElem);
}
if (extra > MAX_LEV_DISTANCE) {
extra = levenshtein(ty.name, lastElem);
}
if (extra < MAX_LEV_DISTANCE + 1) {
lev_total += extra;
ret_lev = Math.min(ret_lev,
Math.round(lev_total / (startsWith.length + 1)));
}
ret_lev = Math.min(ret_lev, Math.round(lev_total / startsWith.length));
}
}
return ret_lev;
@ -934,6 +926,13 @@
}
lev += lev_add;
if (lev > 0 && val.length > 3 && searchWords[j].startsWith(val)) {
if (val.length < 6) {
lev -= 1;
} else {
lev = 0;
}
}
if (in_args <= MAX_LEV_DISTANCE) {
if (results_in_args[fullId] === undefined) {
results_in_args[fullId] = {
@ -1447,7 +1446,7 @@
// Draw a convenient sidebar of known crates if we have a listing
if (rootPath === '../') {
var sidebar = document.getElementsByClassName('sidebar')[0];
var sidebar = document.getElementsByClassName('sidebar-elems')[0];
var div = document.createElement('div');
div.className = 'block crate';
div.innerHTML = '<h3>Crates</h3>';

View File

@ -1011,6 +1011,26 @@ h4 > .important-traits {
left: -22px;
top: 24px;
}
#titles > div > div.count {
float: left;
width: 100%;
}
#titles {
height: 50px;
}
}
@media (max-width: 416px) {
#titles {
height: 73px;
}
#titles > div {
height: 73px;
}
}
.modal {

View File

@ -0,0 +1,16 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(align_offset)]
fn main() {
let x = 1 as *const u8;
assert_eq!(x.align_offset(8), 7);
}

View File

@ -0,0 +1,16 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_name = "foo"]
// @has foo/fn.foo.html
// @has - '//*[@class="rust fn"]' 'pub fn foo<X, Y: ?Sized>(_: &X)'
// @has - '//*[@class="rust fn"]' 'where X: ?Sized,'
pub fn foo<X, Y: ?Sized>(_: &X) where X: ?Sized {}

View File

@ -2,7 +2,7 @@ error[E0255]: the name `foo` is defined multiple times
--> $DIR/blind-item-item-shadow.rs:13:5
|
11 | mod foo { pub mod foo { } }
| ---------------------------- previous definition of the module `foo` here
| ------- previous definition of the module `foo` here
12 |
13 | use foo::foo;
| ^^^^^^^^ `foo` reimported here

View File

@ -1,20 +1,13 @@
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
--> $DIR/issue-26046-fn-mut.rs:14:19
|
14 | let closure = || { //~ ERROR expected a closure that
| ___________________^
15 | | num += 1;
16 | | };
| |_____^
17 |
18 | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
note: closure is `FnMut` because it mutates the variable `num` here
--> $DIR/issue-26046-fn-mut.rs:15:9
|
14 | let closure = || { //~ ERROR expected a closure that
| ^^ this closure implements `FnMut`, not `Fn`
15 | num += 1;
| ^^^
| --- closure is `FnMut` because it mutates the variable `num` here
...
18 | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
error: aborting due to previous error

View File

@ -1,20 +1,13 @@
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
--> $DIR/issue-26046-fn-once.rs:14:19
|
14 | let closure = move || { //~ ERROR expected a closure
| ___________________^
15 | | vec
16 | | };
| |_____^
17 |
18 | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
note: closure is `FnOnce` because it moves the variable `vec` out of its environment
--> $DIR/issue-26046-fn-once.rs:15:9
|
14 | let closure = move || { //~ ERROR expected a closure
| ^^^^^^^ this closure implements `FnOnce`, not `Fn`
15 | vec
| ^^^
| --- closure is `FnOnce` because it moves the variable `vec` out of its environment
...
18 | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
error: aborting due to previous error

View File

@ -2,17 +2,17 @@ error[E0119]: conflicting implementations of trait `Sweet`:
--> $DIR/coherence-overlap-downstream.rs:18:1
|
17 | impl<T:Sugar> Sweet for T { }
| ----------------------------- first implementation here
| ------------------------- first implementation here
18 | impl<T:Fruit> Sweet for T { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`:
--> $DIR/coherence-overlap-downstream.rs:24:1
|
23 | impl<X, T> Foo<X> for T where T: Bar<X> {}
| ------------------------------------------ first implementation here
| --------------------------------------- first implementation here
24 | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
= note: downstream crates may implement trait `Bar<_>` for type `i32`

View File

@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed:
--> $DIR/coherence-overlap-issue-23516.rs:18:1
|
17 | impl<T:Sugar> Sweet for T { }
| ----------------------------- first implementation here
| ------------------------- first implementation here
18 | impl<U:Sugar> Sweet for Box<U> { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>`
|
= note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`

View File

@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`:
--> $DIR/coherence-overlap-upstream.rs:22:1
|
21 | impl<T> Foo for T where T: Remote {}
| ------------------------------------ first implementation here
| --------------------------------- first implementation here
22 | impl Foo for i16 {}
| ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
| ^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
|
= note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions

View File

@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait
| --------------------- definition of `foo` from trait
...
19 | fn foo() where U: 'a { } //~ ERROR E0276
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
| ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
error: aborting due to previous error

View File

@ -1,14 +1,11 @@
error[E0276]: impl has stricter requirements than trait
--> $DIR/region-extra-2.rs:19:5
|
15 | fn renew<'b: 'a>(self) -> &'b mut [T];
| -------------------------------------- definition of `renew` from trait
15 | fn renew<'b: 'a>(self) -> &'b mut [T];
| -------------------------------------- definition of `renew` from trait
...
19 | / fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
20 | | //~^ ERROR E0276
21 | | &mut self[..]
22 | | }
| |_____^ impl has extra requirement `'a: 'b`
19 | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait
| --------- definition of `foo` from trait
...
19 | fn foo() where 'a: 'b { } //~ ERROR impl has stricter
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
| ^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait
| --------------------- definition of `foo` from trait
...
19 | fn foo() where V: 'a { }
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
| ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait
| ---------------------------- definition of `b` from trait
...
25 | fn b<F: Sync, G>(&self, _x: F) -> F { panic!() } //~ ERROR E0276
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: std::marker::Sync`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: std::marker::Sync`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait
| -------------------------------- definition of `test_error1_fn` from trait
...
36 | fn test_error1_fn<T: Ord>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Ord`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Ord`
error[E0276]: impl has stricter requirements than trait
--> $DIR/traits-misc-mismatch-1.rs:40:5
@ -14,7 +14,7 @@ error[E0276]: impl has stricter requirements than trait
| -------------------------------------- definition of `test_error2_fn` from trait
...
40 | fn test_error2_fn<T: Eq + B>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
error[E0276]: impl has stricter requirements than trait
--> $DIR/traits-misc-mismatch-1.rs:44:5
@ -23,7 +23,7 @@ error[E0276]: impl has stricter requirements than trait
| -------------------------------------- definition of `test_error3_fn` from trait
...
44 | fn test_error3_fn<T: B + Eq>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
error[E0276]: impl has stricter requirements than trait
--> $DIR/traits-misc-mismatch-1.rs:54:5
@ -32,7 +32,7 @@ error[E0276]: impl has stricter requirements than trait
| ------------------------------- definition of `test_error5_fn` from trait
...
54 | fn test_error5_fn<T: B>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
error[E0276]: impl has stricter requirements than trait
--> $DIR/traits-misc-mismatch-1.rs:60:5
@ -41,7 +41,7 @@ error[E0276]: impl has stricter requirements than trait
| ------------------------------- definition of `test_error7_fn` from trait
...
60 | fn test_error7_fn<T: A + Eq>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Eq`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Eq`
error[E0276]: impl has stricter requirements than trait
--> $DIR/traits-misc-mismatch-1.rs:63:5
@ -50,7 +50,7 @@ error[E0276]: impl has stricter requirements than trait
| ------------------------------- definition of `test_error8_fn` from trait
...
63 | fn test_error8_fn<T: C>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: C`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: C`
error[E0276]: impl has stricter requirements than trait
--> $DIR/traits-misc-mismatch-1.rs:76:5
@ -59,7 +59,7 @@ error[E0276]: impl has stricter requirements than trait
| ---------------------------------- definition of `method` from trait
...
76 | fn method<G: Getter<usize>>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `G: Getter<usize>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `G: Getter<usize>`
error: aborting due to 7 previous errors

View File

@ -1,14 +1,11 @@
error[E0276]: impl has stricter requirements than trait
--> $DIR/traits-misc-mismatch-2.rs:23:5
|
19 | fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
| ------------------------------------------------------------------ definition of `zip` from trait
19 | fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
| ------------------------------------------------------------------ definition of `zip` from trait
...
23 | / fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
24 | | //~^ ERROR E0276
25 | | ZipIterator{a: self, b: other}
26 | | }
| |_____^ impl has extra requirement `U: Iterator<B>`
23 | fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: Iterator<B>`
error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::Extern
--> $DIR/complex-impl.rs:19:1
|
19 | impl<R> External for (Q, R) {} //~ ERROR must be used
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `complex_impl_support`:
- impl<'a, 'b, 'c, T, U, V, W> complex_impl_support::External for (T, complex_impl_support::M<'a, 'b, 'c, std::boxed::Box<U>, V, W>)

View File

@ -1,12 +1,8 @@
error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`:
--> $DIR/conflict-with-std.rs:17:1
|
17 | / impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
18 | | fn as_ref(&self) -> &Q {
19 | | &**self
20 | | }
21 | | }
| |_^
17 | impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `alloc`:
- impl<T> std::convert::AsRef<T> for std::boxed::Box<T>
@ -15,12 +11,8 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for
error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`:
--> $DIR/conflict-with-std.rs:24:1
|
24 | / impl From<S> for S { //~ ERROR conflicting implementations
25 | | fn from(s: S) -> S {
26 | | s
27 | | }
28 | | }
| |_^
24 | impl From<S> for S { //~ ERROR conflicting implementations
| ^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> std::convert::From<T> for T;
@ -28,13 +20,8 @@ error[E0119]: conflicting implementations of trait `std::convert::From<S>` for t
error[E0119]: conflicting implementations of trait `std::convert::TryFrom<X>` for type `X`:
--> $DIR/conflict-with-std.rs:31:1
|
31 | / impl TryFrom<X> for X { //~ ERROR conflicting implementations
32 | | type Error = ();
33 | | fn try_from(u: X) -> Result<X, ()> {
34 | | Ok(u)
35 | | }
36 | | }
| |_^
31 | impl TryFrom<X> for X { //~ ERROR conflicting implementations
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T, U> std::convert::TryFrom<U> for T

View File

@ -1,10 +1,8 @@
error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`:
--> $DIR/issue-23563.rs:23:1
|
23 | / impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
24 | | fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) }
25 | | }
| |_^
23 | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `issue_23563_a`:
- impl<T, U> a::LolFrom<T> for U

View File

@ -1,12 +1,8 @@
error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`:
--> $DIR/issue-27403.rs:15:1
|
15 | / impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
16 | | fn into(self) -> S {
17 | | self.inner
18 | | }
19 | | }
| |_^
15 | impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T, U> std::convert::Into<U> for T

View File

@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&
--> $DIR/issue-28981.rs:15:1
|
15 | impl<Foo> Deref for Foo { } //~ ERROR must be used
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<'a, T> std::ops::Deref for &'a T

View File

@ -1,12 +1,8 @@
error[E0119]: conflicting implementations of trait `std::convert::From<MyError<_>>` for type `MyError<_>`:
--> $DIR/so-37347311.rs:21:1
|
21 | / impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
22 | | fn from(error: S::Error) -> MyError<S> {
23 | | MyError::StorageProblem(error)
24 | | }
25 | | }
| |_^
21 | impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> std::convert::From<T> for T;

View File

@ -1,16 +1,11 @@
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/enum-and-module-in-same-scope.rs:15:1
|
11 | / enum Foo {
12 | | X
13 | | }
| |_- previous definition of the type `Foo` here
14 |
15 | / mod Foo { //~ ERROR the name `Foo` is defined multiple times
16 | | pub static X: isize = 42;
17 | | fn f() { f() } // Check that this does not result in a resolution error
18 | | }
| |_^ `Foo` redefined here
11 | enum Foo {
| -------- previous definition of the type `Foo` here
...
15 | mod Foo { //~ ERROR the name `Foo` is defined multiple times
| ^^^^^^^ `Foo` redefined here
|
= note: `Foo` must be defined only once in the type namespace of this module

View File

@ -2,9 +2,9 @@ error[E0119]: conflicting implementations of trait `MyMarker`:
--> $DIR/feature-gate-overlapping_marker_traits.rs:16:1
|
15 | impl<T: Display> MyMarker for T {}
| ---------------------------------- first implementation here
| ------------------------------- first implementation here
16 | impl<T: Debug> MyMarker for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ error[E0255]: the name `A` is defined multiple times
| ------- previous import of the module `A` here
12 | use self::B;
13 | mod A {} //~ ERROR the name `A` is defined multiple times
| ^^^^^^^^ `A` redefined here
| ^^^^^ `A` redefined here
|
= note: `A` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
@ -20,7 +20,7 @@ error[E0255]: the name `B` is defined multiple times
| ------- previous import of the module `B` here
...
15 | pub mod B {} //~ ERROR the name `B` is defined multiple times
| ^^^^^^^^^^^^ `B` redefined here
| ^^^^^^^^^ `B` redefined here
|
= note: `B` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
@ -34,7 +34,7 @@ error[E0255]: the name `D` is defined multiple times
18 | use C::D;
| ---- previous import of the module `D` here
19 | mod D {} //~ ERROR the name `D` is defined multiple times
| ^^^^^^^^ `D` redefined here
| ^^^^^ `D` redefined here
|
= note: `D` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import

View File

@ -2,7 +2,7 @@ error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-21546.rs:17:1
|
14 | mod Foo { }
| ----------- previous definition of the module `Foo` here
| ------- previous definition of the module `Foo` here
...
17 | struct Foo;
| ^^^^^^^^^^^ `Foo` redefined here
@ -13,7 +13,7 @@ error[E0428]: the name `Bar` is defined multiple times
--> $DIR/issue-21546.rs:24:1
|
21 | mod Bar { }
| ----------- previous definition of the module `Bar` here
| ------- previous definition of the module `Bar` here
...
24 | struct Bar(i32);
| ^^^^^^^^^^^^^^^^ `Bar` redefined here
@ -27,7 +27,7 @@ error[E0428]: the name `Baz` is defined multiple times
| ---------------- previous definition of the type `Baz` here
...
32 | mod Baz { }
| ^^^^^^^^^^^ `Baz` redefined here
| ^^^^^^^ `Baz` redefined here
|
= note: `Baz` must be defined only once in the type namespace of this module
@ -35,10 +35,10 @@ error[E0428]: the name `Qux` is defined multiple times
--> $DIR/issue-21546.rs:40:1
|
37 | struct Qux { x: bool }
| ---------------------- previous definition of the type `Qux` here
| ---------- previous definition of the type `Qux` here
...
40 | mod Qux { }
| ^^^^^^^^^^^ `Qux` redefined here
| ^^^^^^^ `Qux` redefined here
|
= note: `Qux` must be defined only once in the type namespace of this module
@ -49,7 +49,7 @@ error[E0428]: the name `Quux` is defined multiple times
| ------------ previous definition of the type `Quux` here
...
48 | mod Quux { }
| ^^^^^^^^^^^^ `Quux` redefined here
| ^^^^^^^^ `Quux` redefined here
|
= note: `Quux` must be defined only once in the type namespace of this module
@ -57,10 +57,10 @@ error[E0428]: the name `Corge` is defined multiple times
--> $DIR/issue-21546.rs:56:1
|
53 | enum Corge { A, B }
| ------------------- previous definition of the type `Corge` here
| ---------- previous definition of the type `Corge` here
...
56 | mod Corge { }
| ^^^^^^^^^^^^^ `Corge` redefined here
| ^^^^^^^^^ `Corge` redefined here
|
= note: `Corge` must be defined only once in the type namespace of this module

View File

@ -20,7 +20,7 @@ error[E0255]: the name `Sub` is defined multiple times
| ------------- previous import of the trait `Sub` here
...
19 | struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times
| ^^^^^^^^^^^^^^^^^^^^^ `Sub` redefined here
| ^^^^^^^^^^ `Sub` redefined here
|
= note: `Sub` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
@ -35,7 +35,7 @@ error[E0255]: the name `Mul` is defined multiple times
| ------------- previous import of the trait `Mul` here
...
21 | enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times
| ^^^^^^^^^^^^^^^^^ `Mul` redefined here
| ^^^^^^^^ `Mul` redefined here
|
= note: `Mul` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
@ -50,7 +50,7 @@ error[E0255]: the name `Div` is defined multiple times
| ------------- previous import of the trait `Div` here
...
23 | mod Div { } //~ ERROR the name `Div` is defined multiple times
| ^^^^^^^^^^^ `Div` redefined here
| ^^^^^^^ `Div` redefined here
|
= note: `Div` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
@ -65,7 +65,7 @@ error[E0255]: the name `Rem` is defined multiple times
| ------------- previous import of the trait `Rem` here
...
25 | trait Rem { } //~ ERROR the name `Rem` is defined multiple times
| ^^^^^^^^^^^^^^ `Rem` redefined here
| ^^^^^^^^^ `Rem` redefined here
|
= note: `Rem` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import

View File

@ -1,16 +1,11 @@
error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `MyStruct`:
--> $DIR/issue-28568.rs:17:1
|
13 | / impl Drop for MyStruct {
14 | | fn drop(&mut self) { }
15 | | }
| |_- first implementation here
16 |
17 | / impl Drop for MyStruct {
18 | | //~^ ERROR conflicting implementations of trait
19 | | fn drop(&mut self) { }
20 | | }
| |_^ conflicting implementation for `MyStruct`
13 | impl Drop for MyStruct {
| ---------------------- first implementation here
...
17 | impl Drop for MyStruct {
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyStruct`
error: aborting due to previous error

View File

@ -1,72 +1,35 @@
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:17:13
|
17 | / unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
19 | | |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
20 | | w.set_len(32);
21 | | } };
22 | | }
| |_____________^ unnecessary `unsafe` block
15 | unsafe {
| ------ because it's nested under this `unsafe` block
16 | let f = |v: &mut Vec<_>| {
17 | unsafe { //~ ERROR unnecessary `unsafe`
| ^^^^^^ unnecessary `unsafe` block
|
note: lint level defined here
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:11:8
|
11 | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
note: because it's nested under this `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:15:5
|
15 | / unsafe {
16 | | let f = |v: &mut Vec<_>| {
17 | | unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
... |
29 | | f(&mut v);
30 | | }
| |_____^
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:19:38
|
19 | |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
| ______________________________________^
20 | | w.set_len(32);
21 | | } };
| |_________________^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:15:5
|
15 | / unsafe {
16 | | let f = |v: &mut Vec<_>| {
17 | | unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
... |
29 | | f(&mut v);
30 | | }
| |_____^
15 | unsafe {
| ------ because it's nested under this `unsafe` block
...
19 | |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:23:34
|
23 | |x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
| __________________________________^
24 | | x.set_len(40);
25 | | } };
| |_____________^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:15:5
|
15 | / unsafe {
16 | | let f = |v: &mut Vec<_>| {
17 | | unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
... |
29 | | f(&mut v);
30 | | }
| |_____^
15 | unsafe {
| ------ because it's nested under this `unsafe` block
...
23 | |x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
| ^^^^^^ unnecessary `unsafe` block
error: aborting due to 3 previous errors

View File

@ -1,239 +1,156 @@
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:14:1
|
14 | / fn foo() { //~ ERROR function cannot return without recurring
15 | | foo();
16 | | }
| |_^
14 | fn foo() { //~ ERROR function cannot return without recurring
| ^^^^^^^^ cannot return without recurring
15 | foo();
| ----- recursive call site
|
note: lint level defined here
--> $DIR/lint-unconditional-recursion.rs:11:9
|
11 | #![deny(unconditional_recursion)]
| ^^^^^^^^^^^^^^^^^^^^^^^
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:15:5
|
15 | foo();
| ^^^^^
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:24:1
|
24 | / fn baz() { //~ ERROR function cannot return without recurring
25 | | if true {
26 | | baz()
27 | | } else {
28 | | baz()
29 | | }
30 | | }
| |_^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:26:9
|
24 | fn baz() { //~ ERROR function cannot return without recurring
| ^^^^^^^^ cannot return without recurring
25 | if true {
26 | baz()
| ^^^^^
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:28:9
|
| ----- recursive call site
27 | } else {
28 | baz()
| ^^^^^
| ----- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:36:1
|
36 | / fn quz() -> bool { //~ ERROR function cannot return without recurring
37 | | if true {
38 | | while quz() {}
39 | | true
... |
42 | | }
43 | | }
| |_^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:38:15
|
36 | fn quz() -> bool { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^^^^ cannot return without recurring
37 | if true {
38 | while quz() {}
| ^^^^^
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:41:16
|
| ----- recursive call site
...
41 | loop { quz(); }
| ^^^^^
| ----- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:47:5
|
47 | / fn bar(&self) { //~ ERROR function cannot return without recurring
48 | | self.bar()
49 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:48:9
|
47 | fn bar(&self) { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^ cannot return without recurring
48 | self.bar()
| ^^^^^^^^^^
| ---------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:53:5
|
53 | / fn bar(&self) { //~ ERROR function cannot return without recurring
54 | | loop {
55 | | self.bar()
56 | | }
57 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:55:13
|
53 | fn bar(&self) { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^ cannot return without recurring
54 | loop {
55 | self.bar()
| ^^^^^^^^^^
| ---------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:62:5
|
62 | / fn bar(&self) { //~ ERROR function cannot return without recurring
63 | | 0.bar()
64 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:63:9
|
62 | fn bar(&self) { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^ cannot return without recurring
63 | 0.bar()
| ^^^^^^^
| ------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:75:5
|
75 | / fn bar(&self) { //~ ERROR function cannot return without recurring
76 | | Foo2::bar(self)
77 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:76:9
|
75 | fn bar(&self) { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^ cannot return without recurring
76 | Foo2::bar(self)
| ^^^^^^^^^^^^^^^
| --------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:81:5
|
81 | / fn bar(&self) { //~ ERROR function cannot return without recurring
82 | | loop {
83 | | Foo2::bar(self)
84 | | }
85 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:83:13
|
81 | fn bar(&self) { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^ cannot return without recurring
82 | loop {
83 | Foo2::bar(self)
| ^^^^^^^^^^^^^^^
| --------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:91:5
|
91 | / fn qux(&self) { //~ ERROR function cannot return without recurring
92 | | self.qux();
93 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:92:9
|
91 | fn qux(&self) { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^ cannot return without recurring
92 | self.qux();
| ^^^^^^^^^^
| ---------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:96:5
|
96 | / fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
97 | | Baz::as_ref(self)
98 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:97:9
|
96 | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
97 | Baz::as_ref(self)
| ^^^^^^^^^^^^^^^^^
| ----------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:103:5
|
103 | / fn default() -> Baz { //~ ERROR function cannot return without recurring
104 | | let x = Default::default();
105 | | x
106 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:104:17
|
103 | fn default() -> Baz { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^^^^^^^ cannot return without recurring
104 | let x = Default::default();
| ^^^^^^^^^^^^^^^^^^
| ------------------ recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:112:5
|
112 | / fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
113 | | &**self
114 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:113:10
|
112 | fn deref(&self) -> &() { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
113 | &**self
| ^^^^^^
| ------ recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:119:5
|
119 | / fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
120 | | &self[x]
121 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:120:10
|
119 | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
120 | &self[x]
| ^^^^^^^
| ------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: function cannot return without recurring
--> $DIR/lint-unconditional-recursion.rs:128:5
|
128 | / fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
129 | | self.as_ref()
130 | | }
| |_____^
|
note: recursive call site
--> $DIR/lint-unconditional-recursion.rs:129:9
|
128 | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
129 | self.as_ref()
| ^^^^
| ---- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
error: aborting due to 14 previous errors

View File

@ -5,7 +5,7 @@ error[E0255]: the name `transmute` is defined multiple times
| ------------------- previous import of the value `transmute` here
12 |
13 | fn transmute() {}
| ^^^^^^^^^^^^^^^^^ `transmute` redefined here
| ^^^^^^^^^^^^^^ `transmute` redefined here
|
= note: `transmute` must be defined only once in the value namespace of this module
help: You can use `as` to change the binding name of the import

View File

@ -2,7 +2,7 @@ error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:26:13
|
26 | fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
| ^^^^^^^^^ unnecessary `unsafe` block
| ^^^^^^ unnecessary `unsafe` block
|
note: lint level defined here
--> $DIR/lint-unused-unsafe.rs:14:9
@ -14,97 +14,54 @@ error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:27:13
|
27 | fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block
| ^^^^^^^^^^^^^^^^^ unnecessary `unsafe` block
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:28:20
|
28 | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
| ^^^^^^^^^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` fn
--> $DIR/lint-unused-unsafe.rs:28:1
|
28 | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ---------------- ^^^^^^ unnecessary `unsafe` block
| |
| because it's nested under this `unsafe` fn
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:29:13
|
29 | fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unnecessary `unsafe` block
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:30:20
|
30 | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block
| ^^^^^^^^^^^^^^^^^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` fn
--> $DIR/lint-unused-unsafe.rs:30:1
|
30 | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ---------------- ^^^^^^ unnecessary `unsafe` block
| |
| because it's nested under this `unsafe` fn
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:33:9
|
33 | / unsafe { //~ ERROR: unnecessary `unsafe` block
34 | | unsf()
35 | | }
| |_________^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` block
--> $DIR/lint-unused-unsafe.rs:32:5
|
32 | / unsafe { // don't put the warning here
33 | | unsafe { //~ ERROR: unnecessary `unsafe` block
34 | | unsf()
35 | | }
36 | | }
| |_____^
32 | unsafe { // don't put the warning here
| ------ because it's nested under this `unsafe` block
33 | unsafe { //~ ERROR: unnecessary `unsafe` block
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:39:5
|
39 | / unsafe { //~ ERROR: unnecessary `unsafe` block
40 | | unsafe { //~ ERROR: unnecessary `unsafe` block
41 | | unsf()
42 | | }
43 | | }
| |_____^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` fn
--> $DIR/lint-unused-unsafe.rs:38:1
|
38 | / unsafe fn bad7() {
39 | | unsafe { //~ ERROR: unnecessary `unsafe` block
40 | | unsafe { //~ ERROR: unnecessary `unsafe` block
41 | | unsf()
42 | | }
43 | | }
44 | | }
| |_^
38 | unsafe fn bad7() {
| ---------------- because it's nested under this `unsafe` fn
39 | unsafe { //~ ERROR: unnecessary `unsafe` block
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
--> $DIR/lint-unused-unsafe.rs:40:9
|
40 | / unsafe { //~ ERROR: unnecessary `unsafe` block
41 | | unsf()
42 | | }
| |_________^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` fn
--> $DIR/lint-unused-unsafe.rs:38:1
|
38 | / unsafe fn bad7() {
39 | | unsafe { //~ ERROR: unnecessary `unsafe` block
40 | | unsafe { //~ ERROR: unnecessary `unsafe` block
41 | | unsf()
42 | | }
43 | | }
44 | | }
| |_^
38 | unsafe fn bad7() {
| ---------------- because it's nested under this `unsafe` fn
39 | unsafe { //~ ERROR: unnecessary `unsafe` block
40 | unsafe { //~ ERROR: unnecessary `unsafe` block
| ^^^^^^ unnecessary `unsafe` block
error: aborting due to 8 previous errors

View File

@ -1,15 +1,11 @@
error[E0119]: conflicting implementations of trait `Foo` for type `u8`:
--> $DIR/specialization-feature-gate-overlap.rs:23:1
|
19 | / impl<T> Foo for T {
20 | | fn foo(&self) {}
21 | | }
| |_- first implementation here
22 |
23 | / impl Foo for u8 { //~ ERROR E0119
24 | | fn foo(&self) {}
25 | | }
| |_^ conflicting implementation for `u8`
19 | impl<T> Foo for T {
| ----------------- first implementation here
...
23 | impl Foo for u8 { //~ ERROR E0119
| ^^^^^^^^^^^^^^^ conflicting implementation for `u8`
error: aborting due to previous error

View File

@ -2,15 +2,12 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closur
--> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:24:13
|
24 | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait
| ^^^^^^^^^^^^
| ^^^^^^^^-^^^
| | |
| | closure is `FnOnce` because it moves the variable `y` out of its environment
| this closure implements `FnOnce`, not `Fn`
25 | foo(c);
| --- the requirement to implement `Fn` derives from here
|
note: closure is `FnOnce` because it moves the variable `y` out of its environment
--> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:24:21
|
24 | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait
| ^
error: aborting due to previous error