Skip to content

Rollup of 8 pull requests #112013

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 20 commits into from
May 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f52db3e
Stop confusing specification levels when computing expectations.
cjgillot May 18, 2023
8e39927
Migrate item_static to Askama
sladyn98 May 25, 2023
ea32791
Update current implementation comments for `select_nth_unstable`
Sp00ph May 26, 2023
b084c52
Generate docs for bootstrap itself
jyn514 May 26, 2023
9078fd5
Fix failing CI
sladyn98 May 26, 2023
e7fa993
do not prefer substs relate during coherence
lcnr May 26, 2023
b6b9611
remove unnecessary `.ok()` calls
lcnr May 26, 2023
df98e3e
Fixed tests
sladyn98 May 26, 2023
aa67ae2
Formatted file correctly
sladyn98 May 26, 2023
39f337a
Make errors from `x doc` less verbose
jyn514 May 26, 2023
ad77bc8
print const and type errors in braces not square brackets
BoxyUwU May 26, 2023
b19466a
improve error message for calling a method on a raw pointer with an u…
asquared31415 May 25, 2023
51cf1b6
Rollup merge of #111714 - cjgillot:lint-expect-confusion, r=wesleywiser
matthiaskrgr May 26, 2023
1e766bf
Rollup merge of #111927 - sladyn98:item-static, r=GuillaumeGomez
matthiaskrgr May 26, 2023
e7068ff
Rollup merge of #111954 - asquared31415:unknown_ptr_type_error, r=com…
matthiaskrgr May 26, 2023
18398ad
Rollup merge of #111973 - Sp00ph:update_current_impl, r=Amanieu
matthiaskrgr May 26, 2023
76bb98c
Rollup merge of #111976 - jyn514:doc-bootstrap, r=ozkanonur
matthiaskrgr May 26, 2023
a81ef8a
Rollup merge of #111977 - jyn514:doc-errors, r=est31
matthiaskrgr May 26, 2023
dfdbf1b
Rollup merge of #111987 - lcnr:alias-relate-coherence, r=BoxyUwU
matthiaskrgr May 26, 2023
a992097
Rollup merge of #111991 - BoxyUwU:change_error_term_display, r=compil…
matthiaskrgr May 26, 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
Next Next commit
Stop confusing specification levels when computing expectations.
  • Loading branch information
cjgillot committed May 18, 2023
commit f52db3ecaa47167137cdbe48bd7d56bb5f9c9d3c
10 changes: 7 additions & 3 deletions compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ impl LintLevelsProvider for LintLevelQueryMap<'_> {

struct QueryMapExpectationsWrapper<'tcx> {
tcx: TyCtxt<'tcx>,
/// HirId of the currently investigated element.
cur: HirId,
/// Level map for `cur`.
specs: ShallowLintLevelMap,
expectations: Vec<(LintExpectationId, LintExpectation)>,
unstable_to_stable_ids: FxHashMap<LintExpectationId, LintExpectationId>,
Expand All @@ -255,11 +257,11 @@ impl LintLevelsProvider for QueryMapExpectationsWrapper<'_> {
self.specs.specs.get(&self.cur.local_id).unwrap_or(&self.empty)
}
fn insert(&mut self, id: LintId, lvl: LevelAndSource) {
let specs = self.specs.specs.get_mut_or_insert_default(self.cur.local_id);
specs.clear();
specs.insert(id, lvl);
self.specs.specs.get_mut_or_insert_default(self.cur.local_id).insert(id, lvl);
}
fn get_lint_level(&self, lint: &'static Lint, _: &Session) -> LevelAndSource {
// We cannot use `tcx.lint_level_at_node` because we want to know in which order the
// attributes have been inserted, in particular whether an `expect` follows a `forbid`.
self.specs.lint_level_id_at_node(self.tcx, LintId::of(lint), self.cur)
}
fn push_expectation(&mut self, id: LintExpectationId, expectation: LintExpectation) {
Expand Down Expand Up @@ -355,7 +357,9 @@ impl<'tcx> Visitor<'tcx> for LintLevelsBuilder<'_, LintLevelQueryMap<'tcx>> {

impl<'tcx> LintLevelsBuilder<'_, QueryMapExpectationsWrapper<'tcx>> {
fn add_id(&mut self, hir_id: HirId) {
// Change both the `HirId` and the associated specs.
self.provider.cur = hir_id;
self.provider.specs.specs.clear();
self.add(self.provider.tcx.hir().attrs(hir_id), hir_id == hir::CRATE_HIR_ID, Some(hir_id));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// check-pass
// compile-flags: -Dunused_attributes

#![deny(unused_crate_dependencies)]
#![feature(lint_reasons)]

fn main() {}