-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Clean up check_consts
and misc fixes
#119072
Conversation
Could you pull this out into several PRs, or at least several commits that can be reviewed separately? Specifically, I'd like to see:
Thanks!! Sorry for the extra work '^^ |
dd851f7
to
0c6e578
Compare
let mut selcx = SelectionContext::new(&infcx); | ||
selcx.select(&obligation) | ||
}; | ||
if let Ok(Some(ImplSource::UserDefined(data))) = implsrc { |
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.
Instead of just matching on ImplSource::UserDefined
, I feel like we should just directly call Instance::resolve
here:
if let Ok(Some(func)) = instance
&& let InstanceDef::Item(def) = func.def
{
callee = def;
}
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.
Maybe also then comment that this is just necessary to select a more specific item for const stability. If the instance-resolve fails, then we'll look at the const stability of the trait item, rather than a more specific impl item.
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.
done
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.
Why are we still using select here? I don't think it's needed with the Instance::resolve
call.
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.
Perhaps I misread your previous comment. I will fix in a moment.
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.
Sorry, no, I wasn't clear. I don't think we need implsrc (or select) at all now, since we can resolve the item here.
0c6e578
to
7ae2736
Compare
@rustbot author One more nit |
7ae2736
to
357a7f5
Compare
This comment has been minimized.
This comment has been minimized.
357a7f5
to
df1a4c6
Compare
@rustbot ready |
@bors r+ |
…=compiler-errors Clean up `check_consts` and misc fixes 1. Remove most of the logic around erroring with trait methods. I have kept the part resolving it to a concrete impl, as that is used for const stability checks. 2. Turning on `effects` causes ICE with generic args, due to `~const Tr` when `Tr` is not `#[const_trait]` tripping up expectation in code that handles generic args, more specifically here: https://github.com/rust-lang/rust/blob/8681e077b8afa99d60acf8f8470a012a3ce709a5/compiler/rustc_hir_analysis/src/astconv/generics.rs#L377 We set `arg_count.correct` to `Err` to correctly signal that an error has already been reported. 3. UI test blesses. Edit(fmease): Fixes rust-lang#117244 (UI test is in rust-lang#119099 for now). r? compiler-errors
…iaskrgr Rollup of 2 pull requests Successful merges: - rust-lang#119072 (Clean up `check_consts` and misc fixes) - rust-lang#119231 (Clairify `ast::PatKind::Struct` presese of `..` by using an enum instead of a bool) r? `@ghost` `@rustbot` modify labels: rollup
☀️ Test successful - checks-actions |
Finished benchmarking commit (edcbcc7): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 668.853s -> 669.674s (0.12%) |
effects
causes ICE with generic args, due to~const Tr
whenTr
is not#[const_trait]
tripping up expectation in code that handles generic args, more specifically here:rust/compiler/rustc_hir_analysis/src/astconv/generics.rs
Line 377 in 8681e07
We set
arg_count.correct
toErr
to correctly signal that an error has already been reported.Edit(fmease): Fixes #117244 (UI test is in #119099 for now).
r? compiler-errors