Skip to content
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

Rollup of 9 pull requests #101223

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3fc35b5
Use getentropy when possible on all Apple platforms
BlackHoleFox Aug 25, 2022
908ac84
openbsd: rustc_target: reorder spec by name
semarie Aug 26, 2022
e89d4fc
remove span_fatal from ast_lowering
JeanCASPAR Aug 26, 2022
dca5f5b
Drive-by: Rename expr_t to base_ty
compiler-errors Aug 27, 2022
0734200
Use autoderef
compiler-errors Aug 27, 2022
703603a
Only suggest call on nonexistent fields and methods if they make sense
compiler-errors Aug 27, 2022
cef0482
Add test
compiler-errors Aug 27, 2022
2f78dd1
Suggest calling trait objects and parameters too, when possible
compiler-errors Aug 27, 2022
18b640a
Suggest calling when operator types mismatch
compiler-errors Aug 28, 2022
1256530
More descriptive argument placeholders
compiler-errors Aug 28, 2022
7bb47a6
Reinstate preloading of some dll imports
ChrisDenton Aug 20, 2022
dacb6ee
add powerpc64-unknown-openbsd support
semarie Aug 28, 2022
1de5b22
add riscv64gc-unknown-openbsd support (target riscv64-unknown-openbsd…
semarie Aug 28, 2022
1b8025a
Fix some possible UB in std::sys::windows
thomcc Aug 29, 2022
5a4f7d4
Tweak WellFormedLocs a bit
compiler-errors Aug 30, 2022
d9c760d
Fix UWP and use `AlignedReparseBuf` in `symlink_junction_inner`
thomcc Aug 30, 2022
8af7f42
Code deduplication in tool_only_multipart_suggestion
Xiretza Aug 22, 2022
6e8dad5
Use span_suggestion_with_style in SessionSubdiagnostic derive
Xiretza Aug 22, 2022
9dc0643
SessionSubdiagnostic: make `#[applicability]` optional
Xiretza Aug 26, 2022
1f69fbc
Unify indentation in subdiagnostic-derive test
Xiretza Aug 26, 2022
5c3490c
Replace `AlignedAs` with a more specific `Align8` type
thomcc Aug 30, 2022
31b939b
Rework SessionSubdiagnostic derive to support multipart_suggestion
Xiretza Aug 23, 2022
c41f21b
Fix UB in Windows `DirBuffIter` (provenance and alignment)
thomcc Aug 30, 2022
ea8671e
interpret: use new OpTy::len for Len rvalue
RalfJung Aug 3, 2022
79d4f09
Change fatal diagnostic to an error.
JeanCASPAR Aug 30, 2022
c4e96aa
Rollup merge of #100085 - RalfJung:op-ty-len, r=oli-obk
matthiaskrgr Aug 31, 2022
8852f98
Rollup merge of #100970 - Xiretza:derive-multipart-suggestion, r=davi…
matthiaskrgr Aug 31, 2022
d00693b
Rollup merge of #100984 - ChrisDenton:reinstate-init, r=Mark-Simulacrum
matthiaskrgr Aug 31, 2022
765c777
Rollup merge of #101011 - BlackHoleFox:apple-random-improvements, r=t…
matthiaskrgr Aug 31, 2022
78e1294
Rollup merge of #101025 - semarie:openbsd-archs, r=petrochenkov
matthiaskrgr Aug 31, 2022
eda68d7
Rollup merge of #101049 - JeanCASPAR:remove-span_fatal-from-ast_lower…
matthiaskrgr Aug 31, 2022
eb792e8
Rollup merge of #101100 - compiler-errors:generalize-call-suggestions…
matthiaskrgr Aug 31, 2022
69bd4d6
Rollup merge of #101171 - thomcc:fix-winfs-ub, r=ChrisDenton
matthiaskrgr Aug 31, 2022
92c6dfa
Rollup merge of #101185 - compiler-errors:tweak-wf-locs, r=davidtwco
matthiaskrgr Aug 31, 2022
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
7 changes: 7 additions & 0 deletions compiler/rustc_ast_lowering/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,10 @@ pub struct ArbitraryExpressionInPattern {
#[primary_span]
pub span: Span,
}

#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::inclusive_range_with_no_end)]
pub struct InclusiveRangeWithNoEnd {
#[primary_span]
pub span: Span,
}
12 changes: 9 additions & 3 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use super::errors::{
AsyncGeneratorsNotSupported, AsyncNonMoveClosureNotSupported, AwaitOnlyInAsyncFnAndBlocks,
BaseExpressionDoubleDot, ClosureCannotBeStatic, FunctionalRecordUpdateDestructuringAssignemnt,
GeneratorTooManyParameters, NotSupportedForLifetimeBinderAsyncClosure, RustcBoxAttributeError,
UnderscoreExprLhsAssign,
GeneratorTooManyParameters, InclusiveRangeWithNoEnd, NotSupportedForLifetimeBinderAsyncClosure,
RustcBoxAttributeError, UnderscoreExprLhsAssign,
};
use super::ResolverAstLoweringExt;
use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs};
Expand Down Expand Up @@ -1264,7 +1264,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
(Some(..), Some(..), HalfOpen) => hir::LangItem::Range,
(None, Some(..), Closed) => hir::LangItem::RangeToInclusive,
(Some(..), Some(..), Closed) => unreachable!(),
(_, None, Closed) => self.diagnostic().span_fatal(span, "inclusive range with no end"),
(start, None, Closed) => {
self.tcx.sess.emit_err(InclusiveRangeWithNoEnd { span });
match start {
Some(..) => hir::LangItem::RangeFrom,
None => hir::LangItem::RangeFull,
}
}
};

let fields = self.arena.alloc_from_iter(
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#![feature(never_type)]
#![recursion_limit = "256"]
#![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

#[macro_use]
extern crate tracing;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {

Len(place) => {
let src = self.eval_place(place)?;
let mplace = self.force_allocation(&src)?;
let len = mplace.len(self)?;
let op = self.place_to_op(&src)?;
let len = op.len(self)?;
self.write_scalar(Scalar::from_machine_usize(len, self), &dest)?;
}

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/ast_lowering.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,5 @@ ast_lowering_not_supported_for_lifetime_binder_async_closure =

ast_lowering_arbitrary_expression_in_pattern =
arbitrary expressions aren't allowed in patterns

ast_lowering_inclusive_range_with_no_end = inclusive range with no end
17 changes: 5 additions & 12 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,19 +686,12 @@ impl Diagnostic {
suggestion: Vec<(Span, String)>,
applicability: Applicability,
) -> &mut Self {
assert!(!suggestion.is_empty());
self.push_suggestion(CodeSuggestion {
substitutions: vec![Substitution {
parts: suggestion
.into_iter()
.map(|(span, snippet)| SubstitutionPart { snippet, span })
.collect(),
}],
msg: self.subdiagnostic_message_to_diagnostic_message(msg),
style: SuggestionStyle::CompletelyHidden,
self.multipart_suggestion_with_style(
msg,
suggestion,
applicability,
});
self
SuggestionStyle::CompletelyHidden,
)
}

/// Prints out a message with a suggested edit of the code.
Expand Down
19 changes: 15 additions & 4 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1249,9 +1249,13 @@ impl HandlerInner {
}

fn treat_err_as_bug(&self) -> bool {
self.flags
.treat_err_as_bug
.map_or(false, |c| self.err_count() + self.lint_err_count >= c.get())
self.flags.treat_err_as_bug.map_or(false, |c| {
self.err_count()
+ self.lint_err_count
+ self.delayed_span_bugs.len()
+ self.delayed_good_path_bugs.len()
>= c.get()
})
}

fn print_error_count(&mut self, registry: &Registry) {
Expand Down Expand Up @@ -1407,7 +1411,14 @@ impl HandlerInner {
// This is technically `self.treat_err_as_bug()` but `delay_span_bug` is called before
// incrementing `err_count` by one, so we need to +1 the comparing.
// FIXME: Would be nice to increment err_count in a more coherent way.
if self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() + 1 >= c.get()) {
if self.flags.treat_err_as_bug.map_or(false, |c| {
self.err_count()
+ self.lint_err_count
+ self.delayed_span_bugs.len()
+ self.delayed_good_path_bugs.len()
+ 1
>= c.get()
}) {
// FIXME: don't abort here if report_delayed_bugs is off
self.span_bug(sp, msg);
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ macro_rules! pluralize {
/// All suggestions are marked with an `Applicability`. Tools use the applicability of a suggestion
/// to determine whether it should be automatically applied or if the user should be consulted
/// before applying the suggestion.
#[derive(Copy, Clone, Debug, PartialEq, Hash, Encodable, Decodable, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, Hash, Encodable, Decodable, Serialize, Deserialize)]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub enum Applicability {
/// The suggestion is definitely what the user intended, or maintains the exact meaning of the code.
/// This suggestion should be automatically applied.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ fn main() {
};

// RISC-V GCC erroneously requires libatomic for sub-word
// atomic operations. FreeBSD uses Clang as its system
// atomic operations. Some BSD uses Clang as its system
// compiler and provides no libatomic in its base system so
// does not want this.
if !target.contains("freebsd") && target.starts_with("riscv") {
if target.starts_with("riscv") && !target.contains("freebsd") && !target.contains("openbsd") {
println!("cargo:rustc-link-lib=atomic");
}

Expand Down
Loading