Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #106758

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ad79b20
std tests: use __OsLocalKeyInner from realstd
RalfJung Jan 9, 2023
1a99361
Revert "warn newer available version of the x tool"
DebugSteven Jan 11, 2023
0d834d9
keep --wrapper-version argument in x
DebugSteven Jan 11, 2023
4e30ad8
Reuse ErrorGuaranteed during relation
compiler-errors Dec 30, 2022
83fbc71
Filter impl and where-clause candidates that reference errors
compiler-errors Jan 1, 2023
24bb36e
Consolidate two almost duplicated fn info extraction routines
compiler-errors Dec 27, 2022
2024aa4
Make `&`-removal suggestion verbose
estebank Jan 2, 2023
ce83be4
Account for type params
estebank Jan 2, 2023
bb72117
fix rebase
estebank Jan 7, 2023
8b8cce1
Use the root trait predicate to determine whether to remove references
estebank Jan 9, 2023
48b7e2a
Stabilize `::{core,std}::pin::pin!`
danielhenrymantilla Oct 31, 2022
621d412
Fix invalid syntax in impl Trait parameter type suggestions for E0311
Dec 26, 2022
8fa79a1
Rollup merge of #103800 - danielhenrymantilla:stabilize-pin-macro, r=…
Dylan-DPC Jan 12, 2023
989503e
Rollup merge of #106167 - yanchen4791:issue-105544-fix, r=oli-obk
Dylan-DPC Jan 12, 2023
c09bd57
Rollup merge of #106171 - compiler-errors:consolidate-extract_callabl…
Dylan-DPC Jan 12, 2023
11e4a4f
Rollup merge of #106309 - compiler-errors:prefer-non-err-candidates, …
Dylan-DPC Jan 12, 2023
22001ef
Rollup merge of #106360 - estebank:remove-borrow-suggestion, r=compil…
Dylan-DPC Jan 12, 2023
40ccb98
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
Dylan-DPC Jan 12, 2023
1c9e2d4
Rollup merge of #106733 - DebugSteven:revert-104552-warn-newer-x, r=j…
Dylan-DPC Jan 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Filter impl and where-clause candidates that reference errors
  • Loading branch information
compiler-errors committed Jan 11, 2023
commit 83fbc71d021d2aa741ad18890e7a51a28830d45e
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
.param_env
.caller_bounds()
.iter()
.filter_map(|o| o.to_opt_poly_trait_pred());
.filter_map(|p| p.to_opt_poly_trait_pred())
.filter(|p| !p.references_error());

// Micro-optimization: filter out predicates relating to different traits.
let matching_bounds =
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2377,6 +2377,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let impl_substs = self.infcx.fresh_substs_for_item(obligation.cause.span, impl_def_id);

let impl_trait_ref = impl_trait_ref.subst(self.tcx(), impl_substs);
if impl_trait_ref.references_error() {
return Err(());
}

debug!(?impl_trait_ref);

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/c-variadic/issue-86053-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// error-pattern:unexpected `self` parameter in function
// error-pattern:`...` must be the last argument of a C-variadic function
// error-pattern:cannot find type `F` in this scope
// error-pattern:in type `&'a &'b usize`, reference has a longer lifetime than the data it references


#![feature(c_variadic)]
#![crate_type="lib"]
Expand Down
22 changes: 2 additions & 20 deletions tests/ui/c-variadic/issue-86053-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,6 @@ help: you might be missing a type parameter
LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self ,
| +++

error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references
--> $DIR/issue-86053-1.rs:11:52
|
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/issue-86053-1.rs:10:16
|
LL | fn ordering4 < 'a , 'b > ( a : , self , self , self ,
| ^^
note: but the referenced data is only valid for the lifetime `'b` as defined here
--> $DIR/issue-86053-1.rs:10:21
|
LL | fn ordering4 < 'a , 'b > ( a : , self , self , self ,
| ^^

error: aborting due to 12 previous errors
error: aborting due to 11 previous errors

Some errors have detailed explanations: E0412, E0491.
For more information about an error, try `rustc --explain E0412`.
For more information about this error, try `rustc --explain E0412`.
43 changes: 3 additions & 40 deletions tests/ui/const-generics/generic_const_exprs/issue-72787.min.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LL | Condition<{ LHS <= RHS }>: True
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/issue-72787.rs:25:25
--> $DIR/issue-72787.rs:23:25
|
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
| ^ cannot perform const operation using `I`
Expand All @@ -26,50 +26,13 @@ LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/issue-72787.rs:25:36
--> $DIR/issue-72787.rs:23:36
|
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
| ^ cannot perform const operation using `J`
|
= help: const parameters may only be used as standalone arguments, i.e. `J`
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

error[E0283]: type annotations needed: cannot satisfy `IsLessOrEqual<I, 8>: True`
--> $DIR/issue-72787.rs:21:26
|
LL | IsLessOrEqual<I, 8>: True,
| ^^^^
|
note: multiple `impl`s or `where` clauses satisfying `IsLessOrEqual<I, 8>: True` found
--> $DIR/issue-72787.rs:10:1
|
LL | impl<const LHS: u32, const RHS: u32> True for IsLessOrEqual<LHS, RHS> where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | IsLessOrEqual<I, 8>: True,
| ^^^^
...
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
| ^^^^

error[E0283]: type annotations needed: cannot satisfy `IsLessOrEqual<I, 8>: True`
--> $DIR/issue-72787.rs:21:26
|
LL | IsLessOrEqual<I, 8>: True,
| ^^^^
|
note: multiple `impl`s or `where` clauses satisfying `IsLessOrEqual<I, 8>: True` found
--> $DIR/issue-72787.rs:10:1
|
LL | impl<const LHS: u32, const RHS: u32> True for IsLessOrEqual<LHS, RHS> where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | IsLessOrEqual<I, 8>: True,
| ^^^^
...
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
| ^^^^

error: aborting due to 6 previous errors
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0283`.
2 changes: 0 additions & 2 deletions tests/ui/const-generics/generic_const_exprs/issue-72787.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ struct S<const I: u32, const J: u32>;
impl<const I: u32, const J: u32> S<I, J>
where
IsLessOrEqual<I, 8>: True,
//[min]~^ Error type annotations needed
//[min]~| Error type annotations needed
IsLessOrEqual<J, 8>: True,
IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
//[min]~^ Error generic parameters may not be used in const operations
Expand Down
9 changes: 9 additions & 0 deletions tests/ui/traits/ignore-err-impls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pub struct S;

trait Generic<T> {}

impl<'a, T> Generic<&'a T> for S {}
impl Generic<Type> for S {}
//~^ ERROR cannot find type `Type` in this scope

fn main() {}
11 changes: 11 additions & 0 deletions tests/ui/traits/ignore-err-impls.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0412]: cannot find type `Type` in this scope
--> $DIR/ignore-err-impls.rs:6:14
|
LL | impl Generic<Type> for S {}
| - ^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<Type>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.
14 changes: 14 additions & 0 deletions tests/ui/where-clauses/ignore-err-clauses.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use std::ops::Add;

fn dbl<T>(x: T) -> <T as Add>::Output
where
T: Copy + Add,
UUU: Copy,
//~^ ERROR cannot find type `UUU` in this scope
{
x + x
}

fn main() {
println!("{}", dbl(3));
}
9 changes: 9 additions & 0 deletions tests/ui/where-clauses/ignore-err-clauses.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0412]: cannot find type `UUU` in this scope
--> $DIR/ignore-err-clauses.rs:6:5
|
LL | UUU: Copy,
| ^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.