-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
fix(ty_utils): try normalize earsing regions #111259
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ declare_lint_pass!(QueryStability => [POTENTIAL_QUERY_INSTABILITY]); | |
impl LateLintPass<'_> for QueryStability { | ||
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { | ||
let Some((span, def_id, substs)) = typeck_results_of_method_fn(cx, expr) else { return }; | ||
let substs = cx.tcx.normalize_erasing_regions(cx.param_env, substs); | ||
if let Ok(Some(instance)) = ty::Instance::resolve(cx.tcx, cx.param_env, def_id, substs) { | ||
let def_id = instance.def_id(); | ||
if cx.tcx.has_attr(def_id, sym::rustc_lint_query_instability) { | ||
|
@@ -380,6 +381,7 @@ declare_lint_pass!(Diagnostics => [ UNTRANSLATABLE_DIAGNOSTIC, DIAGNOSTIC_OUTSID | |
impl LateLintPass<'_> for Diagnostics { | ||
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { | ||
let Some((span, def_id, substs)) = typeck_results_of_method_fn(cx, expr) else { return }; | ||
let substs = cx.tcx.normalize_erasing_regions(cx.param_env, substs); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for #105561 |
||
debug!(?span, ?def_id, ?substs); | ||
let has_attr = ty::Instance::resolve(cx.tcx, cx.param_env, def_id, substs) | ||
.ok() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(generic_const_exprs)] | ||
|
||
trait Indices<const N:usize> { | ||
const NUM_ELEMS: usize = 0; | ||
} | ||
|
||
trait Concat { | ||
type Output; | ||
} | ||
|
||
struct Tensor<A: Indices<42>>(A) | ||
where | ||
[(); A::NUM_ELEMS]: Sized; | ||
|
||
impl<I: Indices<42>> Concat for Tensor<I> | ||
where | ||
[(); I::NUM_ELEMS]: Sized | ||
{ | ||
type Output = Tensor<<I as Concat>::Output>; | ||
//~^ ERROR the trait bound `I: Concat` is not satisfied | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0277]: the trait bound `I: Concat` is not satisfied | ||
--> $DIR/issue-110630.rs:20:26 | ||
| | ||
LL | type Output = Tensor<<I as Concat>::Output>; | ||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Concat` is not implemented for `I` | ||
| | ||
help: consider further restricting this bound | ||
| | ||
LL | impl<I: Indices<42> + Concat> Concat for Tensor<I> | ||
| ++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for #105561