From 66dce1114d1014258c8cc586e176f2ea53ab4ed1 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 24 Nov 2019 16:25:20 -0500 Subject: Store ptr_width as u32 on Config This removes the dependency on IntTy, UintTy from Session. --- src/libsyntax/ast.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 14243076941..b8561216896 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1693,6 +1693,18 @@ impl IntTy { IntTy::I128 => 128, }) } + + pub fn normalize(&self, target_width: u32) -> Self { + match self { + IntTy::Isize => match target_width { + 16 => IntTy::I16, + 32 => IntTy::I32, + 64 => IntTy::I64, + _ => unreachable!(), + }, + _ => *self, + } + } } #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable_Generic, @@ -1743,6 +1755,18 @@ impl UintTy { UintTy::U128 => 128, }) } + + pub fn normalize(&self, target_width: u32) -> Self { + match self { + UintTy::Usize => match target_width { + 16 => UintTy::U16, + 32 => UintTy::U32, + 64 => UintTy::U64, + _ => unreachable!(), + }, + _ => *self, + } + } } /// A constraint on an associated type (e.g., `A = Bar` in `Foo` or -- cgit 1.4.1-3-g733a5 From 85fb054fefd1787260c72ee281ed7d436bc524f7 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Mon, 25 Nov 2019 12:36:26 -0800 Subject: Tweak removed feature error --- src/libsyntax/feature_gate/check.rs | 5 ++--- src/test/ui/macros/macro-reexport-removed.stderr | 8 ++------ 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index f966850254f..d37f48f9a4f 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -688,10 +688,9 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute], crate_edition: Edition, allow_features: &Option>) -> Features { fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) { let mut err = struct_span_err!(span_handler, span, E0557, "feature has been removed"); + err.span_label(span, "feature has been removed"); if let Some(reason) = reason { - err.span_note(span, reason); - } else { - err.span_label(span, "feature has been removed"); + err.note(reason); } err.emit(); } diff --git a/src/test/ui/macros/macro-reexport-removed.stderr b/src/test/ui/macros/macro-reexport-removed.stderr index 4bec70850af..475a586ddc0 100644 --- a/src/test/ui/macros/macro-reexport-removed.stderr +++ b/src/test/ui/macros/macro-reexport-removed.stderr @@ -2,13 +2,9 @@ error[E0557]: feature has been removed --> $DIR/macro-reexport-removed.rs:3:12 | LL | #![feature(macro_reexport)] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ feature has been removed | -note: subsumed by `pub use` - --> $DIR/macro-reexport-removed.rs:3:12 - | -LL | #![feature(macro_reexport)] - | ^^^^^^^^^^^^^^ + = note: subsumed by `pub use` error: cannot find attribute `macro_reexport` in this scope --> $DIR/macro-reexport-removed.rs:5:3 -- cgit 1.4.1-3-g733a5