-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Stop using Key
trait unnecessarily
#143441
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
Conversation
rustbot has assigned @petrochenkov. Use |
@@ -71,8 +71,7 @@ pub fn tag_for_variant_provider<'tcx>( | |||
let (ty, variant_index) = key.value; | |||
assert!(ty.is_enum()); | |||
|
|||
let ecx = | |||
InterpCx::new(tcx, ty.default_span(tcx), key.typing_env, crate::const_eval::DummyMachine); | |||
let ecx = InterpCx::new(tcx, DUMMY_SP, key.typing_env, crate::const_eval::DummyMachine); |
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.
We don't need this span anyways, and even if we did, it would be nice to use a relevant def span since it's just an enum anyways.
@@ -69,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for MapUnitFn { | |||
.span_of_impl(*id) | |||
.unwrap_or(default_span), | |||
argument_label: args[0].span, | |||
map_label: arg_ty.default_span(cx.tcx), |
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.
This was DUMMY_SP
, but dummy span labels fall back to the primary span coincidentally (lol)
Key
trait randomlyKey
trait unnecessarily
This comment has been minimized.
This comment has been minimized.
r=me after updating the test outputs. |
@bors r=petrochenkov rollup |
Rollup of 6 pull requests Successful merges: - #143238 (Port `#[ignore]` to the new attribute parsing infrastructure) - #143441 (Stop using `Key` trait unnecessarily) - #143478 (Miri subtree update) - #143486 (remove armv5te-unknown-linux-gnueabi target maintainer) - #143489 (Complete rustc_ast::mut_visit for spans.) - #143494 (Remove yields_in_scope from the scope tree.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 6 pull requests Successful merges: - #143238 (Port `#[ignore]` to the new attribute parsing infrastructure) - #143441 (Stop using `Key` trait unnecessarily) - #143478 (Miri subtree update) - #143486 (remove armv5te-unknown-linux-gnueabi target maintainer) - #143489 (Complete rustc_ast::mut_visit for spans.) - #143494 (Remove yields_in_scope from the scope tree.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143441 - compiler-errors:no-key, r=petrochenkov Stop using `Key` trait unnecessarily Few places where the `Key` trait was being used but not really for a useful reason. This fixes those usages. Namely, `<Ty as Key>::default_span()` is `DUMMY_SP` anyways.
Few places where the
Key
trait was being used but not really for a useful reason. This fixes those usages.Namely,
<Ty as Key>::default_span()
isDUMMY_SP
anyways.