Skip to content

Rollup of 21 pull requests #119547

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

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
aec806e
Add unwrap method for QueryResult
rsmyth-ecmi Dec 18, 2023
95f3a7d
tidy
rsmyth-ecmi Dec 18, 2023
fc561f0
Unwrap the other query result
rsmyth-ecmi Dec 18, 2023
0d9fba1
Add useful panic messages if queries fail to start
rsmyth-ecmi Dec 18, 2023
a482177
Remove parameter from functions that don't need it
rsmyth-ecmi Dec 18, 2023
90c1601
unwrap the correct value in the parallel code
rsmyth-ecmi Dec 18, 2023
0919a51
Wrong layer
rsmyth-ecmi Dec 18, 2023
983cf9c
Actually fixed errors
RossSmyth Dec 19, 2023
b679d8a
Address review conversations
RossSmyth Dec 19, 2023
abe9c14
Fix major diagnostic regression
RossSmyth Dec 21, 2023
f521b4c
suppress change-tracker warnings in containers
onur-ozkan Dec 27, 2023
8dd6fac
don't return suggestion message if no changes detected
onur-ozkan Dec 26, 2023
2c23c06
rc: Take *const T in is_dangling
taiki-e Dec 30, 2023
07adee7
is_coroutine -> is_coroutine_or_closure
compiler-errors Dec 30, 2023
847cd6c
Use the right type for upvars
compiler-errors Dec 30, 2023
86bd81f
Update tracking issue of naked_functions
nbdd0121 Dec 31, 2023
d796ad4
rustdoc ui: adjust tooltip z-index to be above sidebar
Dec 31, 2023
f118c76
Remove two unused feature gates from rustc_query_impl
bjorn3 Dec 31, 2023
5cbe41a
Document that File does not buffer reads/writes, refer to BufReader/B…
chfogelman Dec 26, 2023
884cb41
Minor improvements in comment for
gurry Jan 1, 2024
01ac44a
Pretty-print always-const trait predicates correctly
fmease Dec 31, 2023
b1853eb
use css variable for z-index of the sidebar
Dec 31, 2023
440ba5f
Update books
rustbot Jan 1, 2024
82a5745
Update deadlinks of `strict_provenance` lints
ShE3py Jan 1, 2024
3d0297a
Deny defaults for higher-ranked generic parameters
fmease Jan 1, 2024
23924fe
Mark myself as back from leave
oli-obk Jan 2, 2024
5e7c1b9
coverage: Avoid a query stability hazard in `function_coverage_map`
Zalathar Jan 2, 2024
94c43cc
Report I/O errors with emit_fatal not emit_err
saethlin Jan 2, 2024
ba86034
Don't synthesize host effect params for trait assoc fns marked const
fmease Jan 1, 2024
8f546aa
Turn a bug!() into a span_delay_bug()
fmease Jan 2, 2024
ae8e401
E0379: Make diagnostic more precise
fmease Jan 1, 2024
aa79904
E0379: Provide suggestions
fmease Jan 1, 2024
ee86b1f
llvm: Allow `noundef` in codegen tests
maurer Jan 2, 2024
6f49080
Update `thread_local` examples to use `local_key_cell_methods`
tgross35 Jan 2, 2024
fab6607
compiler: fix typos
vuittont60 Jan 3, 2024
fe4f85c
librustdoc: fix typos
vuittont60 Jan 3, 2024
d9d23fa
Fix: Properly set vendor in i686-win7-windows-msvc target
roblabla Jan 3, 2024
49f42db
Rollup merge of #119086 - RossSmyth:query_panics, r=davidtwco
fmease Jan 3, 2024
e1f8d68
Rollup merge of #119298 - onur-ozkan:silence-change-tracker-warning-f…
fmease Jan 3, 2024
383daa7
Rollup merge of #119319 - chfogelman:buffered-file-doc, r=the8472
fmease Jan 3, 2024
693dd56
Rollup merge of #119434 - taiki-e:rc-is-dangling, r=Mark-Simulacrum
fmease Jan 3, 2024
83ac3a7
Rollup merge of #119444 - compiler-errors:closure-or-coroutine, r=oli…
fmease Jan 3, 2024
f281ad9
Rollup merge of #119474 - nbdd0121:naked, r=Nilstrieb
fmease Jan 3, 2024
e8e5a7e
Rollup merge of #119476 - fmease:pp-always-const-trait-preds, r=compi…
fmease Jan 3, 2024
eeafb86
Rollup merge of #119477 - lukas-code:tooltip-z-index, r=notriddle
fmease Jan 3, 2024
5968c00
Rollup merge of #119479 - bjorn3:remove_unused_feature_gates, r=compi…
fmease Jan 3, 2024
d1b0151
Rollup merge of #119487 - gurry:improve-freshner-comment, r=Nilstrieb
fmease Jan 3, 2024
df2bbb7
Rollup merge of #119492 - rustbot:docs-update, r=ehuss
fmease Jan 3, 2024
bb124aa
Rollup merge of #119494 - fmease:deny-hr-param-defaults, r=compiler-e…
fmease Jan 3, 2024
f2d665f
Rollup merge of #119498 - ShE3py:provenance-lints-doc, r=Nilstrieb
fmease Jan 3, 2024
b2673fa
Rollup merge of #119505 - fmease:no-host-param-for-trait-fns, r=fee1-…
fmease Jan 3, 2024
462505d
Rollup merge of #119510 - saethlin:fatal-io-errors, r=WaffleLapkin,Ni…
fmease Jan 3, 2024
da65d7f
Rollup merge of #119512 - oli-obk:unleave, r=oli-obk
fmease Jan 3, 2024
bfefa4b
Rollup merge of #119514 - Zalathar:query-stability, r=wesleywiser
fmease Jan 3, 2024
7be0135
Rollup merge of #119523 - maurer:fix-sparc-llvm-18, r=nikic
fmease Jan 3, 2024
3dbbddc
Rollup merge of #119534 - tgross35:thread-local-example-updates, r=Jo…
fmease Jan 3, 2024
9511d10
Rollup merge of #119539 - vuittont60:master, r=TaKO8Ki
fmease Jan 3, 2024
89efc1e
Rollup merge of #119544 - roblabla:new-win7-targets, r=Nilstrieb
fmease Jan 3, 2024
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
5 changes: 3 additions & 2 deletions compiler/rustc_ast_lowering/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ ast_lowering_closure_cannot_be_static = closures cannot be static
ast_lowering_coroutine_too_many_parameters =
too many parameters for a coroutine (expected 0 or 1 parameters)

ast_lowering_default_parameter_in_binder = default parameter is not allowed in this binder

ast_lowering_does_not_support_modifiers =
the `{$class_name}` register class does not support template modifiers

Expand All @@ -58,6 +56,9 @@ ast_lowering_functional_record_update_destructuring_assignment =
functional record updates are not allowed in destructuring assignments
.suggestion = consider removing the trailing pattern

ast_lowering_generic_param_default_in_binder =
defaults for generic parameters are not allowed in `for<...>` binders

ast_lowering_generic_type_with_parentheses =
parenthesized type parameters may only be used with a `Fn` trait
.label = only `Fn` traits may use parentheses
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ pub enum BadReturnTypeNotation {
}

#[derive(Diagnostic)]
#[diag(ast_lowering_default_parameter_in_binder)]
pub(crate) struct UnexpectedDefaultParameterInBinder {
#[diag(ast_lowering_generic_param_default_in_binder)]
pub(crate) struct GenericParamDefaultInBinder {
#[primary_span]
pub span: Span,
}
10 changes: 6 additions & 4 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,11 +1241,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
coroutine_kind: Option<CoroutineKind>,
) -> (&'hir hir::Generics<'hir>, hir::FnSig<'hir>) {
let header = self.lower_fn_header(sig.header);
// Don't pass along the user-provided constness of trait associated functions; we don't want to
// synthesize a host effect param for them. We reject `const` on them during AST validation.
let constness = if kind == FnDeclKind::Inherent { sig.header.constness } else { Const::No };
let itctx = ImplTraitContext::Universal;
let (generics, decl) =
self.lower_generics(generics, sig.header.constness, id, &itctx, |this| {
this.lower_fn_decl(&sig.decl, id, sig.span, kind, coroutine_kind)
});
let (generics, decl) = self.lower_generics(generics, constness, id, &itctx, |this| {
this.lower_fn_decl(&sig.decl, id, sig.span, kind, coroutine_kind)
});
(generics, hir::FnSig { header, decl, span: self.lower_span(sig.span) })
}

Expand Down
70 changes: 40 additions & 30 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ use rustc_session::parse::{add_feature_diagnostics, feature_err};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{DesugaringKind, Span, DUMMY_SP};
use smallvec::SmallVec;
use std::borrow::Cow;
use std::collections::hash_map::Entry;
use thin_vec::ThinVec;

Expand Down Expand Up @@ -884,27 +883,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
binder: NodeId,
generic_params: &[GenericParam],
) -> &'hir [hir::GenericParam<'hir>] {
let mut generic_params: Vec<_> = generic_params
.iter()
.map(|param| {
let param = match param.kind {
GenericParamKind::Type { ref default } if let Some(ty) = default => {
// Default type is not permitted in non-lifetime binders.
// So we emit an error and default to `None` to prevent
// potential ice.
self.dcx().emit_err(errors::UnexpectedDefaultParameterInBinder {
span: ty.span(),
});
let param = GenericParam {
kind: GenericParamKind::Type { default: None },
..param.clone()
};
Cow::Owned(param)
}
_ => Cow::Borrowed(param),
};
self.lower_generic_param(param.as_ref(), hir::GenericParamSource::Binder)
})
let mut generic_params: Vec<_> = self
.lower_generic_params_mut(generic_params, hir::GenericParamSource::Binder)
.collect();
let extra_lifetimes = self.resolver.take_extra_lifetime_params(binder);
debug!(?extra_lifetimes);
Expand Down Expand Up @@ -2136,7 +2116,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
param: &GenericParam,
source: hir::GenericParamSource,
) -> hir::GenericParam<'hir> {
let (name, kind) = self.lower_generic_param_kind(param);
let (name, kind) = self.lower_generic_param_kind(param, source);

let hir_id = self.lower_node_id(param.id);
self.lower_attrs(hir_id, &param.attrs);
Expand All @@ -2155,6 +2135,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
fn lower_generic_param_kind(
&mut self,
param: &GenericParam,
source: hir::GenericParamSource,
) -> (hir::ParamName, hir::GenericParamKind<'hir>) {
match &param.kind {
GenericParamKind::Lifetime => {
Expand All @@ -2173,22 +2154,51 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
(param_name, kind)
}
GenericParamKind::Type { default, .. } => {
let kind = hir::GenericParamKind::Type {
default: default.as_ref().map(|x| {
// Not only do we deny type param defaults in binders but we also map them to `None`
// since later compiler stages cannot handle them (and shouldn't need to be able to).
let default = default
.as_ref()
.filter(|_| match source {
hir::GenericParamSource::Generics => true,
hir::GenericParamSource::Binder => {
self.dcx().emit_err(errors::GenericParamDefaultInBinder {
span: param.span(),
});

false
}
})
.map(|def| {
self.lower_ty(
x,
def,
&ImplTraitContext::Disallowed(ImplTraitPosition::GenericDefault),
)
}),
synthetic: false,
};
});

let kind = hir::GenericParamKind::Type { default, synthetic: false };

(hir::ParamName::Plain(self.lower_ident(param.ident)), kind)
}
GenericParamKind::Const { ty, kw_span: _, default } => {
let ty = self
.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::GenericDefault));
let default = default.as_ref().map(|def| self.lower_anon_const(def));

// Not only do we deny const param defaults in binders but we also map them to `None`
// since later compiler stages cannot handle them (and shouldn't need to be able to).
let default = default
.as_ref()
.filter(|_| match source {
hir::GenericParamSource::Generics => true,
hir::GenericParamSource::Binder => {
self.dcx().emit_err(errors::GenericParamDefaultInBinder {
span: param.span(),
});

false
}
})
.map(|def| self.lower_anon_const(def));

(
hir::ParamName::Plain(self.lower_ident(param.ident)),
hir::GenericParamKind::Const { ty, default, is_host_effect: false },
Expand Down
17 changes: 15 additions & 2 deletions compiler/rustc_ast_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,21 @@ ast_passes_tilde_const_disallowed = `~const` is not allowed here
.item = this item cannot have `~const` trait bounds

ast_passes_trait_fn_const =
functions in traits cannot be declared const
.label = functions in traits cannot be const
functions in {$in_impl ->
[true] trait impls
*[false] traits
} cannot be declared const
.label = functions in {$in_impl ->
[true] trait impls
*[false] traits
} cannot be const
.const_context_label = this declares all associated functions implicitly const
.remove_const_sugg = remove the `const`{$requires_multiple_changes ->
[true] {" ..."}
*[false] {""}
}
.make_impl_const_sugg = ... and declare the impl to be const instead
.make_trait_const_sugg = ... and declare the trait to be a `#[const_trait]` instead

ast_passes_trait_object_single_bound = only a single explicit lifetime bound is permitted

Expand Down
Loading