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 8 pull requests #133865

Merged
merged 23 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e75aa44
include LLDB and GDB visualizers in MSVC distribution
Walnut356 Dec 2, 2024
ec036cd
Don't try and handle unfed `type_of` on anon consts
BoxyUwU Nov 30, 2024
52d1c30
Add comment to test
BoxyUwU Dec 4, 2024
2a3b4a0
coverage: Extract `subtracted_sum` in counter creation
Zalathar Oct 16, 2024
7ecc677
coverage: Rename `CounterIncrementSite` to just `Site`
Zalathar Nov 27, 2024
aca6dba
coverage: Use a single `make_phys_counter` method
Zalathar Dec 1, 2024
44e4e45
coverage: Add an extra "transcribe" step after counter creation
Zalathar Nov 29, 2024
d7090f3
coverage: Use a separate counter type during counter creation
Zalathar Dec 2, 2024
ba08056
coverage: Remove the expression simplifier from `CoverageCounters`
Zalathar Dec 1, 2024
e52f5bf
Remove `-Zshow-span`.
nnethercote Dec 4, 2024
ec3424a
Remove some noisy tracing
oli-obk Dec 4, 2024
a91c361
Avoid `opaque type not constrained` errors in the presence of other e…
oli-obk Jul 31, 2024
4cbb599
Stop git from merging generated files
oli-obk Dec 4, 2024
836ab5c
make CoercePointee errors translatable
dingxiangfei2009 Dec 2, 2024
52a6bad
Update sysinfo version to 0.33.0
GuillaumeGomez Dec 4, 2024
adeb603
Rollup merge of #133737 - Walnut356:msvc_visualizers, r=onur-ozkan
matthiaskrgr Dec 4, 2024
4b2d68d
Rollup merge of #133774 - dingxiangfei2009:translatable-coerce-pointe…
matthiaskrgr Dec 4, 2024
e6d7ab2
Rollup merge of #133831 - BoxyUwU:ice_on_unfed_type_of, r=compiler-er…
matthiaskrgr Dec 4, 2024
a4dc963
Rollup merge of #133847 - nnethercote:rm-Z-show-span, r=compiler-errors
matthiaskrgr Dec 4, 2024
553db5f
Rollup merge of #133849 - Zalathar:replay, r=oli-obk
matthiaskrgr Dec 4, 2024
ea4e719
Rollup merge of #133850 - oli-obk:push-xryukktpyooq, r=compiler-errors
matthiaskrgr Dec 4, 2024
d80d2c6
Rollup merge of #133851 - oli-obk:push-pzwykzozkomq, r=jieyouxu
matthiaskrgr Dec 4, 2024
670affb
Rollup merge of #133856 - GuillaumeGomez:update-sysinfo, r=clubby789
matthiaskrgr Dec 4, 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
6 changes: 4 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
*.cpp rust
*.h rust
*.rs rust diff=rust
*.fixed linguist-language=Rust
*.mir linguist-language=Rust
*.fixed linguist-language=Rust -merge
*.mir linguist-language=Rust -merge
*.stderr -merge
*.stdout -merge
src/etc/installer/gfx/* binary
src/vendor/** -text
Cargo.lock linguist-generated=false
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_ast_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ ast_passes_precise_capturing_duplicated = duplicate `use<...>` precise capturing

ast_passes_precise_capturing_not_allowed_here = `use<...>` precise capturing syntax not allowed in {$loc}

ast_passes_show_span = {$msg}

ast_passes_stability_outside_std = stability attributes may not be used outside of the standard library

ast_passes_static_without_body =
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,14 +779,6 @@ pub(crate) struct IncompatibleFeatures {
pub f2: Symbol,
}

#[derive(Diagnostic)]
#[diag(ast_passes_show_span)]
pub(crate) struct ShowSpan {
#[primary_span]
pub span: Span,
pub msg: &'static str,
}

#[derive(Diagnostic)]
#[diag(ast_passes_negative_bound_not_supported)]
pub(crate) struct NegativeBoundUnsupported {
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_ast_passes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! The `rustc_ast_passes` crate contains passes which validate the AST in `syntax`
//! parsed by `rustc_parse` and then lowered, after the passes in this crate,
//! by `rustc_ast_lowering`.
//!
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.

// tidy-alphabetical-start
#![allow(internal_features)]
Expand All @@ -18,6 +16,5 @@
pub mod ast_validation;
mod errors;
pub mod feature_gate;
pub mod show_span;

rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
68 changes: 0 additions & 68 deletions compiler/rustc_ast_passes/src/show_span.rs

This file was deleted.

15 changes: 15 additions & 0 deletions compiler/rustc_builtin_macros/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ builtin_macros_cfg_accessible_indeterminate = cannot determine whether the path
builtin_macros_cfg_accessible_literal_path = `cfg_accessible` path cannot be a literal
builtin_macros_cfg_accessible_multiple_paths = multiple `cfg_accessible` paths are specified
builtin_macros_cfg_accessible_unspecified_path = `cfg_accessible` path is not specified

builtin_macros_coerce_pointee_requires_maybe_sized = `derive(CoercePointee)` requires `{$name}` to be marked `?Sized`

builtin_macros_coerce_pointee_requires_one_field = `CoercePointee` can only be derived on `struct`s with at least one field

builtin_macros_coerce_pointee_requires_one_generic = `CoercePointee` can only be derived on `struct`s that are generic over at least one type

builtin_macros_coerce_pointee_requires_one_pointee = exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits

builtin_macros_coerce_pointee_requires_transparent = `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`

builtin_macros_coerce_pointee_too_many_pointees = only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits
.label = here another type parameter is marked as `#[pointee]`


builtin_macros_concat_bytes_array = cannot concatenate doubly nested array
.note = byte strings are treated as arrays of bytes
.help = try flattening the array
Expand Down
97 changes: 56 additions & 41 deletions compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rustc_ast::{
use rustc_attr as attr;
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
use rustc_expand::base::{Annotatable, ExtCtxt};
use rustc_macros::Diagnostic;
use rustc_span::symbol::{Ident, sym};
use rustc_span::{Span, Symbol};
use thin_vec::{ThinVec, thin_vec};
Expand Down Expand Up @@ -38,35 +39,20 @@ pub(crate) fn expand_deriving_coerce_pointee(
.any(|r| matches!(r, attr::ReprTransparent))
});
if !is_transparent {
cx.dcx()
.struct_span_err(
span,
"`CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`",
)
.emit();
cx.dcx().emit_err(RequireTransparent { span });
return;
}
if !matches!(
struct_data,
VariantData::Struct { fields, recovered: _ } | VariantData::Tuple(fields, _)
if !fields.is_empty())
{
cx.dcx()
.struct_span_err(
span,
"`CoercePointee` can only be derived on `struct`s with at least one field",
)
.emit();
cx.dcx().emit_err(RequireOneField { span });
return;
}
(aitem.ident, g)
} else {
cx.dcx()
.struct_span_err(
span,
"`CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`",
)
.emit();
cx.dcx().emit_err(RequireTransparent { span });
return;
};

Expand Down Expand Up @@ -95,10 +81,7 @@ pub(crate) fn expand_deriving_coerce_pointee(

let pointee_param_idx = if type_params.is_empty() {
// `#[derive(CoercePointee)]` requires at least one generic type on the target `struct`
cx.dcx().struct_span_err(
span,
"`CoercePointee` can only be derived on `struct`s that are generic over at least one type",
).emit();
cx.dcx().emit_err(RequireOneGeneric { span });
return;
} else if type_params.len() == 1 {
// Regardless of the only type param being designed as `#[pointee]` or not, we can just use it as such
Expand All @@ -111,19 +94,11 @@ pub(crate) fn expand_deriving_coerce_pointee(
match (pointees.next(), pointees.next()) {
(Some((idx, _span)), None) => idx,
(None, _) => {
cx.dcx().struct_span_err(
span,
"exactly one generic type parameter must be marked as #[pointee] to derive CoercePointee traits",
).emit();
cx.dcx().emit_err(RequireOnePointee { span });
return;
}
(Some((_, one)), Some((_, another))) => {
cx.dcx()
.struct_span_err(
vec![one, another],
"only one type parameter can be marked as `#[pointee]` when deriving CoercePointee traits",
)
.emit();
cx.dcx().emit_err(TooManyPointees { one, another });
return;
}
}
Expand Down Expand Up @@ -181,15 +156,10 @@ pub(crate) fn expand_deriving_coerce_pointee(
pointee_ty_ident.name,
)
{
cx.dcx()
.struct_span_err(
pointee_ty_ident.span,
format!(
"`derive(CoercePointee)` requires {} to be marked `?Sized`",
pointee_ty_ident.name
),
)
.emit();
cx.dcx().emit_err(RequiresMaybeSized {
span: pointee_ty_ident.span,
name: pointee_ty_ident.name.to_ident_string(),
});
return;
}
let arg = GenericArg::Type(s_ty.clone());
Expand Down Expand Up @@ -459,3 +429,48 @@ impl<'a, 'b> rustc_ast::visit::Visitor<'a> for AlwaysErrorOnGenericParam<'a, 'b>
}
}
}

#[derive(Diagnostic)]
#[diag(builtin_macros_coerce_pointee_requires_transparent)]
struct RequireTransparent {
#[primary_span]
span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_coerce_pointee_requires_one_field)]
struct RequireOneField {
#[primary_span]
span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_coerce_pointee_requires_one_generic)]
struct RequireOneGeneric {
#[primary_span]
span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_coerce_pointee_requires_one_pointee)]
struct RequireOnePointee {
#[primary_span]
span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_coerce_pointee_too_many_pointees)]
struct TooManyPointees {
#[primary_span]
one: Span,
#[label]
another: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_coerce_pointee_requires_maybe_sized)]
struct RequiresMaybeSized {
#[primary_span]
span: Span,
name: String,
}
4 changes: 1 addition & 3 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,7 @@ fn run_compiler(
return early_exit();
}

if sess.opts.unstable_opts.parse_crate_root_only
|| sess.opts.unstable_opts.show_span.is_some()
{
if sess.opts.unstable_opts.parse_crate_root_only {
return early_exit();
}

Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ impl<'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
self.tcx.ensure().type_of(param.def_id);
if let Some(default) = default {
// need to store default and type of default
self.tcx.ensure().const_param_default(param.def_id);
if let hir::ConstArgKind::Anon(ac) = default.kind {
self.tcx.ensure().type_of(ac.def_id);
}
self.tcx.ensure().const_param_default(param.def_id);
}
}
}
Expand Down Expand Up @@ -1817,7 +1817,6 @@ fn const_param_default<'tcx>(
),
};
let icx = ItemCtxt::new(tcx, def_id);
// FIXME(const_generics): investigate which places do and don't need const ty feeding
let ct = icx.lowerer().lower_const_arg(default_ct, FeedConstTy::No);
let ct = icx.lowerer().lower_const_arg(default_ct, FeedConstTy::Param(def_id.to_def_id()));
ty::EarlyBinder::bind(ct)
}
Loading
Loading