Skip to content

Some fixes to diagnostics and lints #18417

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

Merged
merged 5 commits into from
Oct 31, 2014
Merged

Some fixes to diagnostics and lints #18417

merged 5 commits into from
Oct 31, 2014

Conversation

ftxqxd
Copy link
Contributor

@ftxqxd ftxqxd commented Oct 29, 2014

I’m not so sure about the way I’ve handled #17567, but at least the error message is an improvement over what it was before (albeit still not quite as good as it was before DST).

trait_ref.user_string(fcx.tcx()),
self_ty.user_string(fcx.tcx())).as_slice());
note_obligation_cause(fcx, obligation);
let is_sized = if let Some(sized_id) = fcx.ccx.tcx.lang_items.sized_trait() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better expressed as a match:

let is_sized = match fcx.ccx.tcx.lang_item.sized_trait() {
    Some(sized_id) => sized_id == trait_ref.def_id,
    None => false
};

Or if you feel more adventurous:

let is_sized = fcx.ccx.tcx.lang_items.sized_trait()
    .map_or(false, |sized_id| sized_id == trait_ref.def_id);

…nt group

These lints are allow by default because they are sometimes too sensitive.
The error messages still aren’t as good as they were before DST, but they better
describe the actual problem, not mentioning `Sized` at all (because that bound
is normally implied, not explicitly stated).

Closes rust-lang#17567.
Closes rust-lang#18040.
Closes rust-lang#18159.
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 30, 2014
@bors bors merged commit 737e396 into rust-lang:master Oct 31, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Oct 29, 2024
fix: Correctly handle `#""` in edition <2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants